PHP's next function is to fully obtain image information. Copy the code as follows :? Phpfunctiongetimageinfo (img) {img is the absolute path of the image file img_infogetimagesize (img); switch (img_info [2]) {case1: imgtypegif; break; c
The code is as follows:
Function getimageinfo (img) {// img is the absolute path of the image file
Img_info = getimagesize (img );
Switch (img_info [2]) {
Case 1:
Imgtype = "gif ";
Break;
Case 2:
Imgtype = "jpg ";
Break;
Case 3:
Imgtype = "png ";
Break;
}
Img_type = imgtype. "image ";
Img_size = ceil (filesize (img)/1000). "k"; // get the file size
New_img_info = array (
"Width" => img_info [0],
"Height" => img_info [1],
"Type" => img_type
"Size" => img_size
}
Return new_img_info;
}
?>
The http://www.bkjia.com/PHPjc/319761.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/319761.htmlTechArticle code is as follows :? Php function getimageinfo (img) {// img is the absolute path of the image file img_info = getimagesize (img); switch (img_info [2]) {case 1: imgtype = "gif "; break; c...