0

当我getimagesize()使用此代码运行单个图像文件时

$list = getimagesize("http://img.bleacherreport.net/img/images/photos/002/386/662/hi-res-159212879_crop_north.jpg?w=650&h=440&q=75");
echo '<pre>';
print_r($list);

它返回

Array
(
    [0] => 650
    [1] => 440
    [2] => 2
    [3] => width="650" height="440"
    [bits] => 8
    [channels] => 3
    [mime] => image/jpeg
)

但是当我getimagesize()循环运行时

foreach ( (array) $image_list as $imagepath )
{
$list = getimagesize($imagepath);
echo '<br/>'.$list[0].'-'.$list[1];
}

它返回1 - 1。这是我的问题。如果我打印数组,它会返回这个$list数组

Array
(
    [0] => 1
    [1] => 1
    [2] => 1
    [3] => width="1" height="1"
    [bits] => 1
    [channels] => 3
    [mime] => image/gif
)

foreach循环的数组列表

Array
(
    [0] => http://b.scorecardresearch.com/p?c1=2&c2=6246855&c4=bleacherreport.com/articles/1694365-nba-free-agents-2013-players-who-will-make-big-impact-on-new-teams&cv=2.0&cj=1
    [1] => http://pixel.quantserve.com/pixel/p-3a-0o8sJKz6Ek.gif
    [2] => http://static2.bleacherreport.net/images/redesign/common/loading/small.gif?1372800971
    [3] => http://static.bleacherreport.net/images/redesign/modules/uber-module/teamstream_header.png
    [4] => http://cdn.bleacherreport.net/images/team_logos/24x24/nba.png
    [5] => http://static.bleacherreport.net/images/redesign/common/icon_comment.png
    [6] => http://img.bleacherreport.net/img/images/photos/002/386/662/hi-res-159212879_crop_north.jpg?w=650&h=440&q=75
    [7] => http://img.bleacherreport.net/img/article/media_slots/photos/000/953/247/hi-res-158291245_crop_exact.jpg?w=650&h=432&q=85
    [8] => http://img.bleacherreport.net/img/article/media_slots/photos/000/953/261/hi-res-7261336_crop_exact.jpg?w=650&h=434&q=85
    [9] => http://img.bleacherreport.net/img/article/media_slots/photos/000/953/256/hi-res-171671545_crop_exact.jpg?w=340&h=227&q=85
    [10] => http://img.bleacherreport.net/img/article/media_slots/photos/000/953/253/hi-res-167372126_crop_exact.jpg?w=650&h=434&q=85
    [11] => http://static2.bleacherreport.net/images/redesign/common/loading/small.gif?1372800971
    [12] => http://img.bleacherreport.net/img/images/photos/002/383/560/hi-res-6914404_crop_650_crop_north.jpg?w=200&h=126&q=75
    [13] => http://img.bleacherreport.net/img/images/photos/002/383/690/ScreenShot2013-07-02at3.21.16PM_crop_north.png?w=200&h=126&q=75
    [14] => http://img.bleacherreport.net/img/images/photos/002/380/987/Screenshot2013-07-01at10.08.02AM_crop_north.jpg?w=200&h=126&q=75
    [15] => http://static.bleacherreport.net/images/redesign/avatars/default-user-icon-comment.png
    [17] => http://static2.bleacherreport.net/images/redesign/common/loading/small.gif?1372800971
    [18] => http://static.bleacherreport.net/images/articles/no-comments.png
    [19] => http://static.bleacherreport.net/images/shared/spinners/big.gif
    [20] => http://static.bleacherreport.net/images/redesign/articles/vote.png
    [21] => http://static.bleacherreport.net/images/redesign/articles/reply.png
    [22] => http://static2.bleacherreport.net/images/redesign/common/loading/small.gif?1372800971
    [23] => http://static2.bleacherreport.net/images/redesign/common/loading/small.gif?1372800971
    [24] => http://img.bleacherreport.net/img/images/photos/002/380/803/ScreenShot2013-06-30at10.54.05PM_crop_north.jpg?w=100&h=68&q=75
    [25] => http://img.bleacherreport.net/img/images/photos/002/386/676/hi-res-157492860_crop_north.jpg?w=100&h=68&q=75
    [26] => http://img.bleacherreport.net/img/images/photos/002/386/826/hi-res-167733787_crop_north.jpg?w=100&h=68&q=75
    [27] => http://img.bleacherreport.net/img/images/photos/002/386/396/ScreenShot2013-07-04at5.12.55PMcopy_original_crop_north.jpg?w=100&h=68&q=75
    [28] => http://img.bleacherreport.net/img/images/photos/002/386/670/hi-res-6960530_crop_north.jpg?w=100&h=68&q=75
    [29] => http://img.bleacherreport.net/img/images/photos/002/386/690/ScreenShot2013-07-05at9.42.36AM_original_crop_north.jpg?w=100&h=68&q=75
    [30] => http://img.bleacherreport.net/img/images/photos/002/265/104/ScreenShot2013-04-17at3.07.21PM_crop_north.png?w=340&h=234&q=75
    [31] => http://img.bleacherreport.net/img/images/photos/002/320/773/hi-res-72281689_crop_north.jpg?w=100&h=68&q=75
    [32] => http://img.bleacherreport.net/img/images/photos/001/909/267/ScreenShot2012-09-27at10.14.17AM_crop_north.png?w=100&h=68&q=75
    [33] => http://static2.bleacherreport.net/images/articles/icon-fb.png?1372800977
    [34] => http://static2.bleacherreport.net/images/redesign/facebook/connect.png?1372800977
    [35] => http://cdn.bleacherreport.net/images/team_logos/50x50/nba.png
    [36] => http://static2.bleacherreport.net/images/redesign/common/loading/small.gif?1372800977
    [38] => http://analytics.bleacherreport.com/b/ss/sidbleacherreport/1/H.25.2--NS/0
)
4

1 回答 1

1

一些图像返回1 - 1的原因是图像是简单的1x1。我只是自己运行代码并下载了一些返回的图像,1 - 1它们是 1px x 1px。

例如,这个是 1x1: http: //pixel.quantserve.com/pixel/p-3a-0o8sJKz6Ek.gif

于 2013-07-05T15:55:01.963 回答