I create an image with an external function.
The function that returns the raw data of the image:
function create_image()
{
...
ImageJPEG($myimg,NULL,85);
$imgdata = ob_get_contents();
ob_end_clean();
return $imgdata;
}
My script which should show what the image looks like:
$rawdata = create_image();
<img src="data:image/jpeg;base64,".base64_encode($rawdata)."" />
Now the image is not complete in the <img>
tag. If I make the quality 50 (with ImageJPEG($myimg,NULL,50);
) the image will be displayed completely. If I catch the rawdata and write it to the disk, the image will be complete in every quality.
$rawdata = create_image();
$im = imagecreatefromstring($rawdata);
ImageJPEG($im,"./test.jpg",90);
Only in the <img>
tag it doesn't work.
Does anybody have an idea why it doesn't work?