php获取图像的KB大小 [英] php get the KB size of an image
问题描述
我一直在谷歌搜索,但是我所得到的只是getimagesize和filesize.
getimagesize剂量获取的KB大小仅仅是宽度和高度,这不是即时消息所寻找的.
filesize给我消息 警告:filesize()[function.filesize]:统计信息针对
该文件是51kb .jpg文件
i've been googleing but all i get is getimagesize and filesize.
getimagesize dosent get the KB size just width and height which is not what im looking for.
filesize give me the message Warning: filesize() [function.filesize]: stat failed for
the file in question is 51kb .jpg file
$imgsize=filesize("http://localhost/projects/site/schwe/user/1/1.jpg");
不起作用
我如何做到这一点?
推荐答案
您无法获取远程元素的文件大小,或者在系统上提供相对路径,或者执行file_get_contents()
首先获取内容
.因此,用filesize('/path/to/local/system')
代替http://.确保其可被php进程读取
You cannot get file size of remote elements, either give a relative path on your system OR do a file_get_contents()
to get contents first
. Thus, instead of http:// , do a filesize('/path/to/local/system')
. Make sure its readable by php process
这篇关于php获取图像的KB大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!