can please take @ code , let me know why not able render generated images page on fly?
<?php ($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 getting in output is
while src
attributes of images 1
!
capture byte stream, convert. you'll need base64_encode
raw byte. use in image tag:
basic idea:
for ($i = 0; $i <= 3; $i++) { ob_start(); // begin capture $im = imagecreatetruecolor(320, 80); $text_color = imagecolorallocate($im, 255, 255, 255); imagestring($im, 20, 20, 5, "test app " . ($i + 1), $text_color); $img = imagejpeg($im, null, 100); $raw = ob_get_clean(); // echo '<div class="map"><img src="data:image/jpeg;base64,'.base64_encode($raw).'" class="img-responsive" alt="cinque terre"></div>'; }
Comments
Post a Comment