rewriteengine on   # '-s' (is regular file, with size) # '-l' (is symbolic link) # '-d' (is directory) # 'ornext|or' (or next condition) # 'nocase|nc' (no case) # 'last|l' (last rule)   rewritecond %{request_filename} -s [or] rewritecond %{request_filename} -l [or] rewritecond %{request_filename} -d rewriterule ^.*$ - [nc,l] rewriterule ^.*$ createthumb.php?path=%{request_uri} [nc,l]   
复制代码
2、createthumb.php文件: 
set_config($config); if($obj->create_thumb($source, $dest)){   ob_clean();   header('content-type:'.mime_content_type($dest));   exit(file_get_contents($dest)); }   ?>
复制代码
3、thumbconfig.php文件: 
 array(     'fromdir' => 'news', // 来源目录     'type' => 'fit',     'width' => 100,     'height' => 100,     'bgcolor' => '#ff0000'  ),     'news_1' => array(     'fromdir' => 'news',     'type' => 'fit',     'width' => 200,     'height' => 200,     'bgcolor' => '#ffff00'  ),     'article' => array(     'fromdir' => 'article',     'type' => 'crop',     'width' => 250,     'height' => 250,     'watermark' => www_path.'/supload/watermark.png'  )   ); ?>
复制代码
访问以下三个路径后会按config自动生成缩略图:  http://localhost/supload/news/2013/07/21/1.jpg  http://localhost/supload/news_1/2013/07/21/1.jpg  http://localhost/supload/article/2013/07/21/2.jpg
   
 
   