I have some code that outputs an image...in the end it's sth like
imagejpeg($image);
Now, I DON'T want to output the image by keeping that code chunk in a separate file image.php like this
<img src="image.php">
Instead I'd like to put the code in a function let's say DrawImage($arr) and at the end have sth like
return imagejpeg($image);
I want to do this to pass arguments to the function(like an array fo instance) AND have html/php in the same page where I'm outputing.
So in the end I'd like to have sth like this:
<img src="<?= DrawImage($list); ?>">
I've tried to do this but I'm not sure how to set the content type(if that's what I'm doing wrong)...I keep getting raw byte data instead of the image.
Any thoughts?
Start Free Trial