简体   繁体   中英

Sending other image that the one requested using .htaccess

My question is:

If i have an image in my html like this

    <img src='http://someURL.com/images/image.jpg'>

not hosted on my server, can I send another image from another external source? Using .htaccess and php. Right now i know how to send another image from any source if my image is stored on my server. So instead of sending the content from "http://someURL.com/images/image.jpg" i would like to send the content from "http://OtherURL.com/maybe/newImage.jpg".

Thanks

You can't do it on server side as the browser goes direct to the external source without asking your server for permission.

You can do it on client side using JavaScript if you want.

Edit: jQuery example solution

jQuery $("img[src=the_image_souce]").attr('src','new_src'); does not work

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