Magento not finding product images (solution)

Posted by on April 20, 2011

I migrated a Magento instance from one host to another, and in the process earnt myself some free beer; everything went well, apart from some of the thumbnail images not appearing. The image URLs would look like :

/media/catalog/product/cache/1/image/5e06319eda06f020e43594a9c230972d/images/catalog/product/placeholder/image.jpg

Things tried which didn’t help :

  1. rebuilding various Magento image caches and so on (login as admin -> System -> Cache management).
  2. Check PHP’s memory limit… (512mb… shouldn’t be a problem!)
  3. Check permissions on the media directory (chown -R www-data media .. didn’t fix it)
  4. Check PHP has gd installed/enabled – yes.
  5. Disable suhosin (no change)
  6. Check PHP logs (nothing relevant)
  7. Check Apache logs (nothing relevant)
  8. Changing the product to use a different thumbnail etc image (didn’t help)

I already knew the original host didn’t have a case sensitive file system, and this was partially fixed this using mod_speling in Apache, but this obviously doesn’t help when e.g. PHP decides to read and resize an image file.

I then tried comparing the contents in media/catalog/product with what’s in the catalog_product_entity_varchar table. So, in my case :

select value from catalog_product_entity_varchar where value like '/F%' limit 1;
returned something like :

/f/i/file_4_1.jpg

And looking in the above mentioned directory, only showed a directory called F. Simple fix… :

mv F f

(Obviously check the table doesn’t make reference to images with /F in them….  in my case it didn’t.)

<<reload web browser; images all appear and everything works.>>

What sort of idiot created case insensitive filesystems… grr.

Still, at least people can now browse online for Kitchens …. and see the appropriate thumbnails.

10 Responses to Magento not finding product images (solution)

  1. Sean

    tar is your friend.
    tar -czvf tarball.tgz directorytobackup
    on the old system, transfer file and
    tar -xzvf tarball.tgz
    on the new system eliminates all that fun.

    Don’t use ftp unless it’s from one Linux system to another. Supposedly, NTFS understands case, rarely do the ftp programs do so. It’s so sweet when you’ve used something like WS-FTP to attempt to sync stuff and it starts asking to overwrite things as well.

  2. David Goodwin

    Sean – I couldn’t – in this case I only had FTP access to the original / old host.

  3. mark

    Thanks a million, just read you post and wish I had seen it a week ago. Thanks, if your ever in Birmingham let me know, I will gladly buy you a pint or three.

  4. David Goodwin

    I do happen to live in Bromsgrove, so Birmingham is quite close by :)

  5. Nur Mohammed Rony

    it did not help me brother. david did you meet with mark :D

  6. David Goodwin

    Rony – no…. that’s too much like socialisation for me….

  7. Ajith

    I was having this same problem until now. Here’s the deal…

    When specifying the amount of memory in your php configurations, you have to specify the M in uppercase. So, there are a few places you can specify it: index.php, php.ini, or .htaccess.

    In all places I was using “512m” and no pictures would load, although the rest of the site was fine. I changed it to “512M” and voila!

    Here’s an example for each of these three files:

    index.php would be: ini_set(‘memory_limit’, ’512M’);

    php.ini would be: memory_limit = 512M

    .htaccess would be: php_value memory_limit 512M

    You don’t necessarily have to use 512, but be sure that you are using an uppercase M.

    Please let me know if this works for you all.

  8. malik naseer

    I contect the server and they hasn’t install “gd library” after this library installation i give the full permission(777) to the media folder and the cache folder which is located in the product folder my problem is solved

  9. StackLinux

    Thanks for this my fix turned out to be: apt-get install php5-gd

    But also the cache folder permissions:
    http://danielfelice.com/images-disppear-after-flushing-image-storage-cache-in-magento

    These two links yours and above are probably THE two most useful on the issue.

    Thanks again!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>