5

I just migrated from Magento 1.9.3.8 to Magento 2.3.4, then i copied the image from Magento 1.9 media to Magento 2 media, i noticed product images still not showing in my Magento 2 frontend, then i run:

php bin/magento catalog:images:resize

enter image description here

Wrong file

libpng warning: iCCP: known incorrect sRGB profile

I already clean the cache , delete the cache file , reindex, but still same error

Updated

i've fixed the libpng error by running, but the wrong file error still exists

find pub/media -type f -iname '*.png' -exec pngcrush -ow -rem allb -reduce {} \;

When i look up the file that causes this error, turns out the file does not exist

2

2 Answers 2

6
+50

I don't think it's related to migration in general, but to how your original images are generated Try solution here it should work for you

As for Wrong file exception, it's thrown in

vendor/magento/framework/Image/Adapter/Gd2.php:64

if (!$filename || filesize($filename) === 0) {
        throw new \InvalidArgumentException('Wrong file');
    }

So I suggest you check that the actual file is not empty

6
  • i already fixed the libpng problem , but the wrong file problem still exist
    – jojo
    Feb 24, 2020 at 3:50
  • Hey @jojo I've checked the code and this error is thrown in vendor/magento/framework/Image/Adapter/Gd2.php:64 It's thrown when the filesize is equals 0 or there's no filename. I suggest you find the file in your screenshot and validate that it's not empty. Also you have masked file name - so can't tell for sure, but you might be using unsupported symbols in file name Feb 24, 2020 at 4:40
  • i've tried to open the file , turns out the file doesn't exist , still need to find a way to bypass this error if the file does not exist
    – jojo
    Feb 24, 2020 at 4:44
  • 2
    You can add filesize check in here vendor/magento/module-media-storage/Service/ImageResize.php:186 like if ($this->mediaDirectory->isFile($originalImagePath) && filesize({path_to_the_file})) so it would just show error without throwing exception which terminates the flow. Feb 24, 2020 at 5:05
  • thanks it works fine
    – jojo
    Feb 24, 2020 at 7:14
2

I'd like to add to the solution, it's how to find empty files in pub/media/ folder

find ./pub/media/ -type f -empty -exec ls -l {} \;
1
  • It helps me to find empty file so i can solve it. Thank you Dec 24, 2021 at 5:04

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.