我有这样的代码:
// Build the path where I want to save the file;
$filePath="uploads/image.jpeg";
/*
* Open an input stream relative to $_FILES['file']['tmp_name']
* and write it in an output stream relative to $filePath;
*/
writeFile($filePath);
echo "Before resizing: ".filesize($filePath)." bytes";
/*
* Create a resized version of the image using imagecopyresampled();
*/
$imageResized = resizeImage($filePath);
/*
* Actually write the image to the same location of the original;
*/
imagejpeg($imageResized, $filePath);
echo "After resizing: ".filesize($filePath)." bytes";现在事实是,ehoes给了我相同的文件大小,而实际上在文件资源管理器中,调整大小后的文件大小要低得多!如何在调整大小后获得正确的文件大小?
发布于 2013-12-13 10:20:03
请参阅文件大小手册:
注意:这个函数的结果是缓存的。有关更多细节,请参见clearstatcache()。
因此,在第二个文件大小调用之前使用clearstatcache()
https://stackoverflow.com/questions/20563914
复制相似问题