php 通过 exif_imagetype() 判断网络图片是否存在!

header("Content-type: text/html; charset=utf-8"); 
 
 $t1 = time();
 $check = array();
 
 $h[0] = "http://www.edai.com/edai/Resource/album/201207/04/2012070402192453.jpg";
 $h[1] = "http://www.edai.com/edai/Resource/album/201207/10/2012071001561465.jpg.thumb.jpg";
 $h[2] = "http://image.tuku.china.com/tuku.military.china.com/military//pic/2012-07-11/8a400dcf-10af-4de3-897f-7e730f0ea3a9.jpg";
 $h[3] = "http://www.edai.com/edai/Resource/album/201207/10/2012071001462919.jpg.thumb.jpg"; 
 $h[4] = "http://www.edai.com/edai/Resource/album/201207/02/223839nigi4vnovnn317gx.jpg.thumb.jpg";
 $h[5] = "http://www.edai.com/edai/Resource/album/201207/04/2012070402192453.jpg";
 $h[6] = "http://www.edai.com/edai/Resource/album/201207/10/2012071001561465.jpg.thumb.jpg";
 $h[7] = "http://image.tuku.china.com/tuku.military.china.com/military//pic/2012-07-11/8a400dcf-10af-4de3-897f-7e730f0ea3a9.jpg";
 $h[8] = "http://www.edai.com/edai/Resource/album/201207/10/2012071001462919.jpg.thumb.jpg"; 
 $h[9] = "http://www.edai.com/edai/Resource/album/201207/02/223839nigi4vnovnn317gx.jpg.thumb.jpg";
 $h[10] = "http://www.edai.com/edai/Resource/album/201207/10/2012071001561465.jpg.thumb.jpg";
 $h[11] = "http://image.tuku.china.com/tuku.military.china.com/military//pic/2012-07-11/8a400dcf-10af-4de3-897f-7e730f0ea3a9.jpg";
 $h[12] = "http://www.edai.com/edai/Resource/album/201207/10/2012071001462919.jpg.thumb.jpg"; 
 $h[13] = "http://www.edai.com/edai/Resource/album/201207/02/223839nigi4vnovnn317gx.jpg.thumb.jpg";
 foreach($h as $v){
 $check[] = @exif_imagetype($v);
 }
 $t2 = time();
 
 echo '
'; 
  
 print_r($check);
  echo '
'; 
  
 
 echo "时间差:". ($t2-$t1);
/*
//exif_imagetype();可能返回的值:
常量
1 IMAGETYPE_GIF
2 IMAGETYPE_JPEG
3 IMAGETYPE_PNG
4 IMAGETYPE_SWF
5 IMAGETYPE_PSD
6 IMAGETYPE_BMP
7 IMAGETYPE_TIFF_II(Intel 字节顺序)
8 IMAGETYPE_TIFF_MM(Motorola 字节顺序)
9 IMAGETYPE_JPC
10 IMAGETYPE_JP2
11 IMAGETYPE_JPX
12 IMAGETYPE_JB2
13 IMAGETYPE_SWC
14 IMAGETYPE_IFF
15 IMAGETYPE_WBMP
16 IMAGETYPE_XBM
*/
?>

你可能感兴趣的:(WEB(php))