All image src request to php script
I want to resize a image using server side script (eg: Smart Image Res开发者_运维百科izer ), so it will send request to a script called image.php
<img src="/image.php/media/bg.jpg?width=320&height=240"/>
So script will take image and its dimensions for cropping.Instead of sending request to image.php or any server scripting why cant i pass all the img src request to image.php automatically. Using .htaccess or something?
<img src="/media/bg.jpg?width=320&height=240"/>
And some config should automatically take it in and pass this
to your image resizer script and return the image result. Is it possible?
Thanks
By automatically, do you mean on page load?
If so, i would use jQuery ajax to send the img to the image.php and display the returned image onto the page. Or am i completely misunderstanding your request?
yes i have got it.
I added this line in .htaccess
RewriteRule ^media/(.*).jpg$ image.php?src=$1 [L]
so when ever request comes into media directory with jpg extension all those will be passed to the image.php
Am i right? I ma trying this way.
精彩评论