Answer the question
In order to leave comments, you need to log in
How can I access images from another domain in Yii using Chtml::image?
Good afternoon!
There is a domain and a subdomain on Yii , I decided to transfer it to a single database. Domain - directory, subdomain - shop. Database merging - only to save space on the hosting (pictures, documents). I usually refer to images like this:
echo Chtml::image(Yii::app->baseUrl().'/images/products/'.$model->CODE.'/'.$model->photo->NAME);
Answer the question
In order to leave comments, you need to log in
set the path to the site where the pictures are stored in the parameters and use
In general, I would recommend storing the absolute url for the image in the database, then everything would be simpler and more flexibleecho Chtml::image($model->photo->URL);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question