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 に答える