I am working on the following code. Why am I not able to render generated images to the page on the fly?
<?php
for ($i = 0; $i <= 3; $i++) {
$im = imagecreatetruecolor(320, 80);
$text_color = imagecolorallocate($im, 255, 255, 255);
imagestring($im, 20, 20, 5, "Test App", $text_color);
$img = imagejpeg($im, 'Test.jpg');
echo '<div class="map"><img src="'.$img.'" class="img-responsive" alt="Cinque Terre"></div>';
imagedestroy($im);
}
?>
What I am getting in the output now is
while the src
attributes of the images are 1
!