image - PHP Get File Contents -


i'm getting error can't figure out, i'm doing have string or bunch of urls , i'm putting them array , looping array , resizing , uploading images,but im getting error. appreciated!

error

file_get_contents(http://a513.phobos.apple.com/us/r1000/094/purple/v4/d4/e4/02/d4e402a3-a485-4d4c-cf9b-90b0af391626/mzl.wbbwbbab.png )  [function.file-get-contents]: failed open stream: http request failed!  http/1.0 400 bad request in "my file" on line 53 

php

include("picture-resize.php");      $image = $_post['thumbnail'];     $slug = $_post['slug'];     $images = $_post['screenshots'];     $list = explode(",", $images);           $listlength = count($list);      $i = 0;      $image = $_post['thumbnail'];      $path = parse_url($image, php_url_path);      $filename = $slug.'-'.$i;      $extension = pathinfo($path, pathinfo_extension);      $file = $filename.'.'.$extension;      file_put_contents('../tmp/' . $file, file_get_contents($image));      $picture = new pic_resize();      $picture->load('../tmp/'.$file);      $picture->resizetowidth(125);      $picture->save('../images/125x125/'.$file, $picture->image_type);      unlink('../tmp/'.$file);      $thumbnail = $file;      $new_list = array();      while($listlength > $i) {          $path = parse_url($list[$i], php_url_path);          $extension = pathinfo($path, pathinfo_extension);          $file = $filename.'.'.$extension;          file_put_contents('../tmp/' . $file, file_get_contents($list[$i]));          $picture = new pic_resize();          $picture->load('../tmp/'.$file);          $picture->resizetowidth(640);          $picture->save('../images/640x320/'.$file, $picture->image_type);          $picture->resizetowidth(310);          $picture->save('../images/310x205/'.$file, $picture->image_type);          unlink('../tmp/'.$file);          array_push($new_list, $file);          $i++;     }     $screenshots = implode($new_list, ','); 

$a = file_get_contents("http://a513.phobos.apple.com/us/r1000/094/purple/v4/d4/e4/02/d4e402a3-a485-4d4c-cf9b-90b0af391626/mzl.wbbwbbab.png"); echo strlen($a); 

works me. can error on environment (firewall, wiruses, http request modifications isp etc.). try paste link in browser:

http://a513.phobos.apple.com/us/r1000/094/purple/v4/d4/e4/02/d4e402a3-a485-4d4c-cf9b-90b0af391626/mzl.wbbwbbab.png

do see image or error? can try other tools download image, wget command on unix ot php curl. note no error code - server response http code 400 - bad request, connected image server http request produced file_get_contents isn't valid.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -