我想调整大小在像这样的网址大小的图像:
http://www.domain.nl/images/chached/200x200/name.jpg
如果图像不存在,我想生成并缓存它。
如何在此之后检查文件是否存在,而不必在/ images / chached /目录中生成文件夹'200x200',而不使用PHP(较慢)。
有没有办法做到这一点与mod_rewrite(更快)?或者这是不可能的?
我使用Kohana 3巫婆使用这个mod_rewite代码:
# Turn on URL rewriting
RewriteEngine On
# Installation directory
# RewriteBase /kohana/
RewriteBase /
# Protect hidden files from being viewed
Order Deny,Allow
Deny From All
# Protect application and system files from being viewed
RewriteRule ^(?:application|modules|system)\b.* index.php/$0 [L]
# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite all other URLs to index.php/URL
RewriteRule .* index.php/$0 [PT]