Case Sensitive Issue – Magento Products

While shifting the your magento site which is hosted in the Windows server to the Linux server you will see strange thing is that the actual product images are not get dispalyed instead magento default product images
appear in all the product.

This problem has discussed in magento forum a lot. I have to thanks Mr.Chris Jones.

How to fix this ? ….. 🙂

Below is the solution is given by the Mr. Chris Jones in Mangeto Forum


fix_magento_catalog(“/yourmagentoinstall/media/catalog/product”, “mysql_host”, “mysql_user”, “mysq_password”,

function list_files_and_folders($path=”.”)
$files = array();
if (is_dir($path))
$fh = opendir($path);
while (($file = readdir($fh)) !== false)
if (strcmp($file, “.”)==0 || strcmp($file, “..”)==0) continue;
$filepath = $path . “/” . $file;
if ( is_dir($filepath) )
array_push($files, $filepath);
$files = array_merge($files, list_files_and_folders($filepath));
array_push($files, $filepath);
$files = false;
return $files;

function fix_magento_catalog($path, $mysql_host, $mysql_username, $mysql_password, $mysql_db)
$files = list_files_and_folders($path);
foreach ($files as $val)
echo “Converting {$val} to”.strtolower($val).” \n”;
rename($val, strtolower($val));

$conn = mysql_connect($mysql_host,$mysql_username,$mysql_password);

$query = mysql_query(“select value_id, value from catalog_product_entity_media_gallery”) or die(mysql_error());

while($result = mysql_fetch_assoc($query)) {
echo “Converting database value {$result[‘value_id’]} to “.strtolower($result[‘value’]).” \n”;
mysql_query(“update catalog_product_entity_media_gallery set value='”.strtolower($result[‘value’]).”‘ where value_id='{$result[‘value_id’]}'”) or die(mysql_error());

In the above code, we are renaming the media/catalog/product subfolders and the files to lowercase and also the changing the the url image path to the loweecase in the following table is must.

  • catalog_product_entity_media_gallery
  • catalog_product_entity_varchar
  • catalog_product_flat_1
  • catalog_product_flat_2
  • catalog_product_flat_3
  • catalog_product_flat_4
  • catalog_product_flat_5
  • catalog_product_flat_6
  • catalog_product_flat_7
  • catalog_product_flat_8
  • catalog_product_flat_9

Above code, the Database update query part is done only for catalog_product_entity_media_gallery table so we have
to do update for other 10 tables.