Leth
Leth

Reputation: 145

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

Upvotes: 1

Views: 35

Answers (1)

Adam Lukaszczyk
Adam Lukaszczyk

Reputation: 4926

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

Upvotes: 1

Related Questions