我正在使用 imagecache_create_path() 和 getimagesize() 来获取 imagecache 生成的图像的路径及其尺寸。但是,如果这是我们第一次访问该图像尚不存在的页面,并且 imagecache_create_path 也不会生成它。
这是代码:
// we get the image path from a preset (always return the path even if the file doesn't exist)
$small_image_path = imagecache_create_path('gallery_image_small', $image["filepath"]);
// I get the image dimensions (only if the file exists already)
$data_small = list($width, $height, $type, $image_attributes) = @getimagesize($small_image_path);
是否有任何 API 方法来获取路径并生成文件?换句话说,我可以从 PHP 生成图像(使用预设)而不在浏览器中显示它吗?
先感谢您