在服務器中有很多圖片,他們的圖片都有空間名稱,例如:home 3.png,my new car.jpg。 我需要獲取所有圖像大小。 爲什麼getimagesize()顯示這些圖像的錯誤?php,getimagesize
錯誤:
Warning: getimagesize(http://127.0.0.1/img 1.jpg) [function.getimagesize]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found...
如果我運行畫面:http://127.0.0.1/img 1.JPG瀏覽器都好(所以鏈接好)。
全碼:
<?php
require_once('simple_html_dom.php');
$string = str_get_html('some text some text <img src = "http://127.0.0.1/img 1.jpg" /> text .... ');
foreach($string->find('img') as $e)
$img[] = $e->src;
$img_1 = getimagesize($img[0]);
print_r($img_1);
?>
請顯示您使用的確切代碼。另外,你確定在這裏使用'http://'包裝器是否合適?您知道使用絕對文件系統路徑訪問文件的可能性(更快)嗎? – 2010-09-30 20:03:16
執行該腳本的服務器是否與映像位於同一臺服務器上運行?否則,出現此錯誤的原因可能是您通過127.0.0.1訪問本地服務器,但服務器位於其他位置,無法訪問您的服務器。 – poke 2010-09-30 20:11:01
我無法想象一個單獨的實例不應該像這樣引用loopback。 – Incognito 2010-09-30 20:40:07