Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

How to use same image for Multiple Products Rate Topic   * * * * * 1 votes

 

Posted 14 June 2012 - 03:14 PM #1

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

 
  • clips
  • Aged Resident Loon
  • Members
  • Join Date: 14-Jan 07
  • 1650 posts

Posted 14 June 2012 - 03:21 PM #2

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

 
  • The Tool
  • Been Here Way Too Long Member
  • Members
  • Join Date: 30-Mar 07
  • 3704 posts

Posted 14 June 2012 - 07:10 PM #3

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.

 

Posted 14 June 2012 - 07:39 PM #4

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.

 
  • brandonvd
  • is Super Awesome
  • Members
  • Join Date: 19-Dec 06
  • 2631 posts

Posted 14 June 2012 - 08:04 PM #5

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);
   	 }

To:

// 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?

Thanks,

Brandon

 

Posted 15 June 2012 - 02:49 PM #6

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

Thanks with the help!!!

 
  • devdhan
  • Newbie
  • Trial users
  • Join Date: 31-Aug 13
  • 7 posts

Posted 10 September 2013 - 05:47 AM #7

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.

 
  • cscartrocks
  • Member
  • Members
  • Join Date: 24-Jan 11
  • 1676 posts

Posted 10 September 2013 - 07:15 AM #8

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

One Step Checkout Addon - The ultimate checkout experience
Best CS-Cart SEO addon - CS-Cart SEO Ultimate Addon
PM for quality custom work/project


 
  • bethanym
  • Newbie
  • Trial users
  • Join Date: 11-Jan 19
  • 2 posts

Posted 13 January 2019 - 07:27 AM #9

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

 

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