osCmax 2.5 thumbnail images not showing after upload case sensitive on Linux

The issue here was that loading some images as extra’s were not appearing as thumbnails in the product display. At least some of them were not. The key was that the ones that worked had a lower case file extension and the ones that did not had upper letters. i.e. .jpg and .JPG

I tracked this to being that the Dynamic Mopics for extra product images is case sensitive. Loading an image from another system (Windows perhaps?) with an upper case .JPG extension will not display the thumbnail without specifying the upper case extension in the admin settings for Dynamic Mopics which has all lower case extensions by default.

Using the default installation admin settings. Load a main product image and an extra jpg type file image with the extension as uppercase .JPG
Using the catalog user view inspect the product and there are no thumbnails displayed.
Modify the admin setting to include JPG (as distinct from jpg) in the viewable formats and the images display.

A simple fix is to force lower case extensions for all image uploads. This is a simple change.

Edit the file catalogadminincludesmodulesproduct_image_upload.php

line 23
[text] $ext = substr(strrchr($main_image, ‘.’), 0);[/text]
becomes
[text] $ext = strtolower(substr(strrchr($main_image, ‘.’), 0));[/text]
(adding the additional function as a wrapper, do not forget the closing parenthesis)

Updating an existing database is also relatively simple in phpMyAdmin or similar select the products table and run the following:
[text]UPDATE products SET products_image = REPLACE(products_image, ‘.JPG’,’.jpg’);[/text]

if the user wants to test the impact of this first display the table with the changes with:
[text]SELECT `products_id`, REPLACE(products_image, ‘.JPG’,’.jpg’) AS ‘products_image’ FROM products;[/text]

2 replies on “osCmax 2.5 thumbnail images not showing after upload case sensitive on Linux”

    • Yes, that is an option, but given that the admin section is obscure and that the system will accept uppercase .JPG files without advising the user that only .jpg lowercase is recognised as a default, it would seem more helpful to the end user to control that for them.

      Alternatively, add more code in the admin area to prevent .JPG or any other upper case combination from uploading, or add a warning that tells the user that the uppercase files will not be shown unless they modify the admin area.

      I think my solution provides a minimal code approach and a better option than ‘let the user guess why their images are faulty’.

Leave a Reply

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