0
我得到一個錯誤,我無法弄清楚,我正在做的是我有一個字符串或一堆網址,我把它們放入一個數組,然後循環數組並調整和上傳圖像,但我得到這個錯誤。任何幫助將非常感謝!PHP獲取文件內容
錯誤
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 to 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, ',');