June 30, 2015, 6:02pm
Hi I have a project that works properly locally. When moving to the live site, everything appears to work with the exception of images not being displayed.
[b]SOURCE CODE FOR VACANT IMAGES in views>brand>index.php
<img src="/../Uploads/<?= Html::encode($products['image'])?>"
I’ve tried a variety of changes including successfully running this under a different sub domain. As mentioned the images display properly locally. Is there a configuration on the common or FE that I need to look to?
Thanks in advance for any light shed on this.
Your path doesn’t look correct and it doesn’t look web accessible. Look at the path of the image that isn’t showing.
Your settings on your local machine and live environment are different. Your local being more lenient than the hosted one.
<img src="<?= Yii::$app->request->baseUrl.'/Uploads/'.Html::encode($products['image'])?>"
youd have to make your folder structure something like this
your uploads needs to be web accessible and depending on your hosting it most likely isn’t due to the security measure hosting providers put on their hosting accounts.
You could create a subdomain and have it point to the uploads i.e.
uploads.yoursite.com and have it point to the uploads folder.
<img src="http://uploads.yoursite.com/<?= Html::encode($products['image'])?>"
and use a param to set the upload url so you just have it change it in one place if need be.
You didn’t give enough information to fix it. For example the error it is throwing.
July 1, 2015, 7:34pm
Thanks skworden. The uploads sub directory worked out great. I really appreciate this.
glad it worked out for you.