Magento not finding product images (solution)

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.

20 thoughts on “Magento not finding product images (solution)”

  1. 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. 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.

  3. 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.

  4. 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

  5. David, thanks very much for this. I had very similar symptoms but a very different problem. In my case I had compiled PHP with GD, but somehow JPEG support did not make it into GD. I was lucky to stumble onto a comment on a similar post suggesting to check the GD install.

    I tested the theory by checking the phpinfo() page, and sure enough, GD didn’t list any JPEG support. Then I uploaded a .png image for a test, and sure enough, the image displayed without an issue. After a recompile of php (note that the –with-jpeg-dir directive must appear before the –with-gd directive in the ./configure line), a make clean && make && sudo make install (and a stop/start of apache), the images immediately appeared as if there hadn’t been a problem.

    It’s quite frustrating that Magento didn’t emit any errors about this… I checked the apache error log, the system error log, and the magento error logs (which there weren’t any, despite correct permissions). I’m hoping this comment can save someone else the same time I spent on it.

  6. I didn’t see any products in the frontend after moving to a fresh Debian install. The html generated page for the categories ended on the image for the first product:
    <img src="
    The logs didn't show any prbolem.
    For me too the fix was to install the php5-gd library on :
    aptitude search php5-gd

    Thanks, StackLinux and malik naseer.

  7. thanks a lot Patrick Cronin, that was exactly my problem but I am compiling php with LITESPEED webserver.

    adding jpeg-dir=/usr/include –with-png-dir=/usr/include to my compilation did the trick 🙂

    tks

  8. David Thanks for highlighting this issue with proper solution.
    I also faced such issues normally but after using a FME media gallery Magento extension ( http://goo.gl/YHxLEx ), it’s now very easy to organize all the product images & other rich media files.

  9. For the benefit of anyone else who has spent their 4 hours tearing their hair out, load a phpinfo.php file, and check the memory limit. If local is not 512M, then hunt for wherever it might be being overriden from.

    Also, check the .htaccess file. Make sure that includes php_value memory_limit 512M

    And now, I resist the temptation to go drink a double whiskey.

  10. I thought I had a similar issue with images permissions after we changed host – I was not getting new images i uploaded to show up – it was showing me the placeholder image and no image symbol on the front end –
    – turns out I forgot to update the origin ip on my CDN
    – so hope this helps someone someday 🙂

  11. Vlad,

    if you have php.ini. just go to yourdomain/php.ini, it will show you on the browser!!! Cheers!

  12. I forgot to mention I have issue with thumbnail images too. On the homepage, new product, etc… they show fine. But when I click on any category, no thumbnail to be found on every single product…. I’m not sure what to do now… I’ve tried everything known on internet….but nothing works for me….
    Anything would help!

Leave a Reply

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