将远程图片读取到本地,并保存
//将远程图片读取到本地,并保存 function grap_Image($url) { if($url=="") return false; $filename = md5($url) . '.jpg'; if(file_exists($filename)) { return $filename; } ob_start(); readfile($url); $img = ob_get_contents(); ob_end_clean(); $size = strlen($img); $fp2=@fopen($filename, "a"); fwrite($fp2,$img); fclose($fp2); return $filename; }
转载保留链接