cancel
Showing results for 
Search instead for 
Did you mean: 

product image in home page not showing images %5C showing in the code instead of \

Re: product image in home page not showing images %5C showing in the code instead of \

I am not using any extensions. The installation is fairly new. Not using anything and just used custom theme but even though I revert back to the default theme it's still not loading the images.

Re: product image in home page not showing images %5C showing in the code instead of \

your reply here is probably a solution but can you help me figure out where I should put the code in?

Please check below ways.

 

1) You can resolve issue by just replacing %5C with /

str_replace("%5C","/",$imageUrl);

 

2) You can get product images proper path by using below way:

protected $_productRepositoryFactory;

public function __construct( \Magento\Catalog\Api\ProductRepositoryInterfaceFactory $productRepositoryFactory
) {            
    $this->_productRepositoryFactory = $productRepositoryFactory;
}

$product = $this->_productRepositoryFactory->create()
    ->getById($item->getProductId());$product->getData('image');$product->getData('thumbnail');$product->getData('small_image');

 

Re: product image in home page not showing images %5C showing in the code instead of \

Hi @isabelchuabf02 ,

 

That solution works if the issue only occurs on custom pages products.

In your case images not loading for whole website.

 

Please try below things as well.

1) If you are using apache2 then try this command:

sudo a2enmod rewrite


2) Open app/etc/di.xml
Find below line
Magento\Framework\App\View\Asset\MaterializationStrategy\Symlink
Replace it with below line
Magento\Framework\App\View\Asset\MaterializationStrategy\Copy

3) If you are using apache2 then in your host conf add below things.
sudo nano /etc/apache2/sites-available/xxxxxxxxx.conf
In your virtualhost configuration add below lines
<Directory /var/www/html>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>

4) sudo service apache2 restart

Do all 4 steps in your local then di compile, content deploy command and check on front-end.

 

Problem solved? Click Accept as Solution!

 

Hope it helps!

Thanks

Ankit Jasani

Re: product image in home page not showing images %5C showing in the code instead of \

thank you! I tried this step but it didn't work.

 

Maybe I need to also point out that the images show up on the categories section but just not when added as a "Product" contentimage.png

so this is the part where it doesn't work when I add them to the home page or other pages which are not default

image.png

Re: product image in home page not showing images %5C showing in the code instead of \

<?= str_replace("\\", '/', $resizedImageUrl) ?>

Re: product image in home page not showing images %5C showing in the code instead of \

Re: product image in home page not showing images %5C showing in the code instead of \ I did this before and did it again but it's still not working change pubg name without rename card.

Re: product image in home page not showing images %5C showing in the code instead of \

Re: product image in home page not showing images %5C showing in the code instead of \

I am not using any extensions. The installation is fairly new. Not using anything and just used custom theme but even though I revert back to the default theme it's still not loading the images Hill Climb Racing 2 Mod Apk