Home > Backend Development > PHP Tutorial > PHP's next very comprehensive function for obtaining image information_PHP Tutorial

PHP's next very comprehensive function for obtaining image information_PHP Tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-21 15:48:22
Original
934 people have browsed it

Copy code The code is as follows:

function getimageinfo(img) { //img is an image file absolute Path
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;
}
?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/319761.htmlTechArticleCopy the code 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...
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template