0

Bit of a strange one, but hopefully it's easy to resolve.

I have uploaded some product Category images to certain category pages in the Admin client but when I view them on the web they don't load. The reason appears to be that it is trying to load two paths in the src attribute, which are slightly different.

enter image description here

Any ideas what I need to do to resolve this... :-)

src="https://www.myurl.com/pub/media/catalog/category//pub/media/catalog/tmp/category/25mm.jpg"

As you can see there are two paths in the URL, one has "tmp" (in bold) and if I modify the SRC this one loads. It appears that it is prepending the URL?

Any ideas would be appreciated.

src="/pub/media/catalog/tmp/category/25mm.jpg" <- This one loads the image?

1
  • do you know how to fix it now?thank you~
    – niceonelee
    Jun 30 '20 at 15:51
0

This was related to the below fix.

https://github.com/magento/magento2/issues/11995

I updated the below code on my site

file \Magento\Catalog\Model\Category\Attribute\Backend\Image.php

private function getUploadedImageName($value)
    {
        if (is_array($value) && isset($value[0]['file'])) {
            return $value[0]['file'];
        }
/* REMOVED 
        if (is_array($value) && isset($value[0]['name'])) {
            return $value[0]['name'];
        }
*/
        return '';
    }

The fact I have had to do this on a live site, on such a key part of the functionality is dumbfounding.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.