E
E
EVOSandru62015-03-13 02:36:34
Yii
EVOSandru6, 2015-03-13 02:36:34

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);

For example, there is a website and poddomen.website How to implement something like this on a subdomain more concisely, so that images are pulled from the images/...
folder of the domain?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alzasr, 2015-03-13
@EVOSandru6

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 flexible
echo Chtml::image($model->photo->URL);

S
Sergey, 2015-03-13
@butteff

I would venture to suggest that you can specify the full path on the server to the folder with pictures. You can find it out via $_SERVER['DOCUMENT_ROOT']

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question