Home > Backend Development > PHP Tutorial > PHP下一个非常全面获取图象信息的函数_php技巧

PHP下一个非常全面获取图象信息的函数_php技巧

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-05-17 09:34:16
Original
974 people have browsed it
复制代码 代码如下:

function getimageinfo(img) { //img为图象文件绝对路径
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."图像";
img_size = ceil(filesize(img)/1000)."k"; //获取文件大小
new_img_info = array (
"width"=>img_info[0],
"height"=>img_info[1],
"type"=>img_type
"size"=>img_size
}
return new_img_info;
}
?>
Related labels:
php
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