How to know where are the images thumbnail ?

I need to get the path where are the thumbnails for using them in my ERP.

I have the name of the file in the mysql base (cscart_images), but what about the url ?



For example with the demo store, a picture is here :

Instant Demo - CS-Cart Multi-Vendor Demo Try Free for 15 days



In my shop, the link is the same, but some images are in other directory that the “0” :

Instant Demo - CS-Cart Multi-Vendor Demo Try Free for 15 days



and some other in :

Instant Demo - CS-Cart Multi-Vendor Demo Try Free for 15 days



Where can i find this number of directory in the tables ? How is it created ?

There is a variable in config.local.php called MAX_FILES_IN_DIR. This somehow controls the number of images per folder and increases this number each time the folder reaches that number and creates a new folder like 1,2,3,4,5 etc…



I have yet to understand how to duplicate the function for my ERP Import so I have just changed my MAX_FILES_IN_DIR to a really high number and then everything goes in /0/.

Nice trick ;)



But as my shop is already filled with products, that would not be possible for me.

Well… Please let me know if you figure it out. I had no luck figuring out how or where CS-Cart keeps track of how many files are in a folder and how it knows when a folder has reached the number to increment to the next folder.



I would like to integrate this into my script but just haven't been able to make sense of how to detect when to goto the next folder.



The other challenge is Cs-Cart uses multiple image types such as variants, categories, and products and i dont see how it knows when to increment to the next folder for any of them. If anyone has a clue please let me me know!

Used the following trick to get the cover of the products.

When you backup the base, the images are saved in the backup directory. All in one folder.

I've made an access from my erp to these images so I have not to find the correct cs folder.

I finally found where to find the number of directory.



It's located in the table cscart_images_links



In that table, the object_ID is the ID of the product.

The Type must be M (it's the main image)

The detailed_ID give the number ID of the image itself.



With an unmodified config.local, the default value for each directory is 1000, so the first number of the detailed_ID gives you the number of the directory.



For example, a detailed_ID of 1457 will be located in the rep /1 and a deteailed_ID of 3722 will be in rep /3



I think that if the MAX_FILES_IN_DIR in config.local has been changed, you just have to make a division by the new value to find the first number.

Hi Pascal,



Thanks for the info about the folder for the thumbnails.



Have you figure out how to know, which folder does the thumbnail being created for a product?



LIke your example



http://demo.cs-cart…ges/thumbnails/[size=6]1[/size]/320/320/UN40D5003BFXZA.jpg



and some other in :

http://demo.cs-cart…ges/thumbnails/[size=6]2[/size]/320/320/UN40D5003BFXZA.jpg



Those 320/320 is not storing all my products, some of it being stored in some other folder etc : /50/86



I really couldn't get a grip what's the logic behind it.



Thanks in advance.

[quote name='Pascal' timestamp='1343742823' post='141907']

I need to get the path where are the thumbnails for using them in my ERP.

I have the name of the file in the mysql base (cscart_images), but what about the url ?



For example with the demo store, a picture is here :

http://demo.cs-cart…0D5003BFXZA.jpg



In my shop, the link is the same, but some images are in other directory that the “0” :

http://demo.cs-cart…ges/thumbnails/[size=6]1[/size]/320/320/UN40D5003BFXZA.jpg



and some other in :

http://demo.cs-cart…ges/thumbnails/[size=6]2[/size]/320/320/UN40D5003BFXZA.jpg



Where can i find this number of directory in the tables ? How is it created ?

[/quote]



HI @Pascal,



You can find product detailed image here:



http://demo.cs-cart…mages/detailed/[color=#ff0000][FOLDER][/color]/[color=#006400][IMAGE][/color][list]

[][color=#ff0000][FOLDER][/color] is generated after formula [color=#ff0000]floor( $image_id / MAX_FILES_IN_DIR)[/color]

[
][color=#006400][IMAGE][/color] is the filename plus extension ex : UN40D5003BFXZA.jpg

[/list]

Product thumbnail is generated on the fly and can by found here (if has been generated already):



http://demo.cs-cart…ges/thumbnails/[color=#ff0000][FOLDER][/color]/[color=#000000][THUMBNAIL_WIDTH][/color]/[color=#000000][THUMBNAIL_HEIGHT][/color]/[color=#006400][IMAGE][/color][list]

[][color=#ff0000][FOLDER][/color] is generating sutomat after formula [color=#ff0000]floor( $image_id / MAX_FILES_IN_DIR)[/color]

[
][color=#006400][IMAGE][/color] is the filename plus extension ex : UN40D5003BFXZA.jpg

[*][color=#000000][THUMBNAIL_WIDTH], [THUMBNAIL_HEIGHT][/color] are the values defined under Settings > Thumbnails for a particular place in site

[/list]

PS: if height is missing the link will be http://demo.cs-cart…ges/thumbnails/[color=#ff0000][FOLDER][/color]/[color=#000000][THUMBNAIL_WIDTH][/color]/[color=#006400][IMAGE][/color]



I hope that helps,





Valentin