curl - Strange "JPEG datastream contains no image" with PHP -


i getting remote image , checking size of it.

sometimes strange error saying jpeg datastream contains no image , narrowed down it's happening @ step, in fact it's happening @ imagecreatefromstring. problem? issue image? or need increase kind of memory setting in php.ini or..?

function ranger($url) {     $headers = array(         "range: bytes=0-32768"     );      $curl = curl_init($url);      curl_setopt($curl, curlopt_httpheader, $headers);     curl_setopt($curl, curlopt_returntransfer, 1);      $data = curl_exec($curl);      curl_close($curl);      return $data; }  $url = $prod['image1']; $raw1 = ranger($url); $im = imagecreatefromstring($raw1); $width = imagesx($im); $height = imagesy($im); 

you need follow these 3 steps solve problem:

  1. as error message states, not have image. need determine why not have image. start running var_dump($raw1) take @ algorithm in general. after step should know why not have image expected one.

  2. ?

  3. user valid image resource parameter of imagecreatefromstring.


Comments

Popular posts from this blog

php - Admin SDK -- get information about the group -

dns - How To Use Custom Nameserver On Free Cloudflare? -

Python Error - TypeError: input expected at most 1 arguments, got 3 -