Home > Backend Development > PHP Tutorial > 图片重定向到timthumb

图片重定向到timthumb

WBOY
Release: 2016-06-06 20:52:18
Original
1101 people have browsed it

网站目录结构

usr/uploads/2012/01/happynewyear.jpg
Copy after login
Copy after login

需要使用缩略图插件实现调用不同大小的图片缩略图。

<img  src="usr/uploads/2012/01/happynewyear_200%C3%97200.jpg" alt="图片重定向到timthumb" >
Copy after login
Copy after login
Copy after login
Copy after login

插入图片后自动调用缩略图插件处理后的图片。
我在
usr/uploads/
Copy after login
Copy after login

目录下放入
timthumb.php
Copy after login
Copy after login

文件,timthumb.php调用链接是
timthumb.php?src=/usr/uploads/2012/01/happynewyear.jpg&h=200&w=200&zc=1
Copy after login
Copy after login

所以我需要使用.htaccess。
这个htaccess文件该怎么写?
也就是

<img  src="usr/uploads/2012/01/happynewyear_200%C3%97200.jpg" alt="图片重定向到timthumb" >
Copy after login
Copy after login
Copy after login
Copy after login

图片重定向到timthumb
Copy after login
Copy after login

显示的是同样一张图片。

回复内容:

网站目录结构

usr/uploads/2012/01/happynewyear.jpg
Copy after login
Copy after login

需要使用缩略图插件实现调用不同大小的图片缩略图。

<img  src="usr/uploads/2012/01/happynewyear_200%C3%97200.jpg" alt="图片重定向到timthumb" >
Copy after login
Copy after login
Copy after login
Copy after login

插入图片后自动调用缩略图插件处理后的图片。
我在
usr/uploads/
Copy after login
Copy after login

目录下放入
timthumb.php
Copy after login
Copy after login

文件,timthumb.php调用链接是
timthumb.php?src=/usr/uploads/2012/01/happynewyear.jpg&h=200&w=200&zc=1
Copy after login
Copy after login

所以我需要使用.htaccess。
这个htaccess文件该怎么写?
也就是

<img  src="usr/uploads/2012/01/happynewyear_200%C3%97200.jpg" alt="图片重定向到timthumb" >
Copy after login
Copy after login
Copy after login
Copy after login

图片重定向到timthumb
Copy after login
Copy after login

显示的是同样一张图片。

RewriteRule ^.*?(usr/uploads/[\d]{4}/[\d]{2}/.+?)_([\d]+)_([\d]+)\.(jpg|gif|png)$ timthumb.php?src=/$1.$4&h=$2&w=$3&zc=1 [L]
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template