How to use same image for Multiple Products

How do you stop CS-Cart UE from copying an image when used for mutliple products?

Example i use the same shirt image for 3 different products. When we import our images for our products CS-Cart will then create a copy and add a alpha numeric code to the end of the file name so now we have 3 of the same image. 1 original image and 2 others with a alpha numeric coding to it in turn it has now made our site directory 3 times as big with the copied images of the same thing. .

We never could figure this one out. If it was called the same thing CS would just change the name of the image.

Not sure about 3.x but there is a piece of code in /core/fn.images.php that needs to be commented out to prevent image renaming.

The Tool:

Could you attach a copy of your fn.Images.php file? so i can see what codeing they used on the version you have and see if I can spot it on the 3.x version.

Here, this should help:

In core/fn.images.php change:

// Generate new filename if file with the same name is already exists
if (file_exists(DIR_IMAGES . $images_path . $image_data['name']) && $image_path != $image_data['name']) {
$image_data['name'] = substr_replace($image_data['name'], uniqid(time()) . '.', strrpos($image_data['name'], '.'), 1);


// Make it so the images don't get the weird name.
// Generate new filename if file with the same name is already exists
//if (file_exists(DIR_IMAGES . $images_path . $image_data['name']) && $image_path != $image_data['name']) {
// $image_data['name'] = substr_replace($image_data['name'], uniqid(time()) . '.', strrpos($image_data['name'], '.'), 1);
// End Weird Name

I haven't tested this in 3 yet, but let us know. The code is the same, so it should work?



The coding is the same as the earlier versions so brandonvd's commenting out fix works.

Thanks with the help!!!

Do you know how to prevent image renaming in CS-Cart 4.0.1?

I really need this function to avoid server load. Please help.

To be honest, this could not help too much on server load.

How to do this in the latest version of CS-Cart?

I'm unable to find that specific code to comment it out.