图片抓取
$url=$_GET["url"];
get_img($url);
/**
* 获取远程图片
* @param $url 图片URL
*/
function get_img($url){
$ext=pathinfo($url,PATHINFO_EXTENSION);
$ext_arr = explode("?",$ext);
$ext=$ext_arr[0];
if($ext=='jpg' || $ext=='gif' || $ext=='png' || $ext=='jpeg' || $ext=='bmp'){
header('Content-type: image/'.$ext);
}else{
header('Content-type: image/jpg');
}
echo file_get_contents($url);
}
网友评论