Answer the question
In order to leave comments, you need to log in
How to do url substitution to display images?
Good afternoon. The task is to display a source of the form https://somesite.ru/image/ ... in the layout , but in fact the loading takes place from another resource, let's say https://anothersite.ru/image/ ... . Is it possible to do this, and if so, how to implement it correctly?
Answer the question
In order to leave comments, you need to log in
If pictures have one address in the DOM
And when loading pictures, it is necessary that the pictures be displayed from another server
. You need to write a JS substitution script that will replace the addresses of the pictures on the fly (or maybe JS will download them for display)
A counter question - if you write such a JS script, then why specify the original SRC of the images at all, if they will then change on the fly
I suspect that you want to hide the real address of the images
In the browser, instead of the src address of the image, you can insert the binary code of the images, and then no one will know from where these images were loaded
JS can be encoded so that no one inside I didn’t annoy from where the pictures are
PS But in Chrome in Webmaster Tools / Network, you can always see from where and how the pictures are pulled
PPS Yii has nothing to do with it at all
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question