I am trying to convert a string to an image using the "imagecreatefromstring
" function
(I've attached the code below). It works for most images, but when I try to convert
larger images, a small portion of the image does not get converted (the lower part
of the image is just grey)
my code is (take it from php.net example) :
$data = base64_decode($record['text']);
$im = imagecreatefromstring($data);
if ($im !== false) {
header('Content-Type: image/jpeg');
imagejpeg($im);
imagedestroy($im);
}
i also try different way to decode the string not in one pice , but splitting the string and then decode it.
for($i=0, $len=strlen($record['text']); $i<$len; $i+=4){
$data.= base64_decode( substr($record['text'], $i, 4) );
}