Processing code on the PHP download page
Processing code on the PHP download page
Function get_extension ($ file) {return substr (strrchr ($ file ,'. '), 1);} function get_name ($ path) {return substr (strrchr ($ path,'/'), 1);} function getImage ($ url, $ fileName = "") {$ fbufsize = 8096; $ ext = get_extension ($ url); $ fileName = get_name ($ url ); $ type = array ('GIF' => 'image/GIF', 'jpeg '=> 'image/jpeg', 'jpg '=> 'image/jpeg ', 'jpe' => 'image/jpeg ', 'PNG' => 'image/png ',); $ imgType = isset ($ Type [$ ext])? $ Type [$ ext]: die ("type mismatch"); header ('content-Description: File Transfer '); header ('expires: 0 '); header ('cache-Control: must-revalidate, post-check = 0, pre-check = 0'); header ('pragma: public '); header ("Content-type :". $ imgType); header ("Content-Transfer-Encoding: binary"); header ('content-Disposition: attachment; filename = "'. $ fileName. '"'); header (" Content-Length :". getimagesize ($ url ). "\ n"); $ fp = fopen ($ ur L, "r"); while (! Feof ($ fp) {print (fread ($ fp, $ fbufsize); flush (); ob_flush () ;}fclose ($ fp); exit ;} getImage (" http://snowcoal.com/IMAGES_6930/201407/1405910422162.jpg ");
The above is the content of the processing code on the PHP download page. For more information, see The PHP Chinese website (www.php1.cn )!