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

yipeiwu_com6年前PHP代码库
复制代码 代码如下:

<?php
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;
}
?>

相关文章

header导出Excel应用示例

复制代码 代码如下: <?php class reportFormAction extends CommonAction{ public function index(){ if(...

PHP函数import_request_variables()用法分析

本文实例分析了PHP函数import_request_variables()用法。分享给大家供大家参考,具体如下: import_request_variables 函数可以在 regi...

解析在apache里面给php写虚拟目录的详细方法

步骤1.首先打开AppServ\Apache2.2\conf里面的httpd.conf文件。在里面找到:LoadModule rewrite_module modules/mod_rew...

php中关于长度计算容易混淆的问题分析

本文实例讲述了php中关于长度计算容易混淆的问题。分享给大家供大家参考,具体如下: 经常被php中数组和字符串的字符函数搞晕,下面总结一下: strlen($string)函数:计算字符...

PHP实现基于图的深度优先遍历输出1,2,3...n的全排列功能

本文实例讲述了PHP实现基于图的深度优先遍历输出1,2,3...n的全排列功能。分享给大家供大家参考,具体如下: <?php $n=$_REQUEST["n"]; if...