Magento 1.9 Image Issue – Product Images Not Showing Due to Uppercase URL

imagemagento-1.9

Since I've migrated Magento 1.7 to 1.9 some images doesn't show up. I found that the ones who doesn't show up are those with uppercase letters in url and when I manually insert lowercase letters, the image show up.

What can I do?

Thank you very much.

Best Answer

First, thanks to R.S to help me found the latest piece to resolve my puzzle.

To solve this problem:

  1. Make a php script to put your files in lowercase (sorry isn't recursive so you will need to make it folder by folder)

    <?php 
    
    // The directory that contains the files that you want to rename to lowercase 
    $directory = "/public_html/media/catalog/product/s/t/"; 
    
    $conn = ftp_connect("website"); 
    ftp_login($conn,"username","password"); 
    
    ftp_pasv($conn,true); 
    
    ftp_chdir($conn,$directory); 
    $dir = ftp_nlist($conn,"."); 
    
    foreach($dir as $fsObject) 
    { 
        if($fsObject != "." || $fsObject != "..") 
        { 
            if($fsObject != strtolower($fsObject)) 
            { 
                ftp_rename($conn,$fsObject,strtolower($fsObject)); 
                echo strtolower($fsObject)."<br>";
            } 
        } 
    } 
    
    ftp_close($conn); 
    echo $directory."<br>";
    echo "Finish!";
    
    ?>
    
  2. Run these SQL queries: update catalog_product_entity_media_gallery set value = lcase(value) where lcase(value) like '%.jpg'; update catalog_product_entity_varchar set set value = lcase(value) where lcase(value) like '%.jpg';

  3. Clean your images cache in Cache Management