imagecreatefromstring fonksiyonu ile sorun

2 Cevap php

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)

benim kod (php.net örnek al) olan:

            $data = base64_decode($record['text']);

            $im = imagecreatefromstring($data);
            if ($im !== false) {
                header('Content-Type: image/jpeg');
                imagejpeg($im);
                imagedestroy($im);
            }

Ben de bir değil pice dize çözmek için farklı bir yol deneyin, ama dize bölme ve sonra çözmek.

 for($i=0, $len=strlen($record['text']); $i<$len; $i+=4){
                $data.= base64_decode( substr($record['text'], $i, 4) );
            }

2 Cevap

Veri kesildi gibi depolama veya alma ya, geliyor. Eğer mağazada tüm görüntüyü sahip olduğunu doğrulayın.

Sen base64 decode için dize gerekmez, muhtemelen sorunun kökü.