简体   繁体   中英

Htaccess make IMAGE to run as PHP or to read content from a PHP file

I have a file image.php with generate a jpeg image with imagejpeg . When somebody want to get a resized image or to crop, he opens http://example.com/image.php?src=http://example.org/image

Now I want this url to be accessible from http://example.com/image.jpg?src=http://example.org/image

I want to to this with htaccess, but i don't want to be a redirect, I want the image.jpg run as the image.php

How can I do this?

I tried:

AddType application/x-httpd-php5 image.jpg

but with no result.

I want to make this because when you want to add the picture in a facebook post, it isn't considered an image if is image.php

Thank you!

希望能帮助到你。

RewriteRule ^image\.jpg$ image.php [L] 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM