Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

folder structure for product images
 
guruproj
Sr. Member
 
Total Posts:  76
Joined:  2009-03-16
 

I’v been playing with magento and see if it fits my needs. I like the features I saw and thought I’m going to switch...until I discovered that I have no control on the structure for product images. I have near 3000 products and each has large, regular and thumnails. All images are named according to their sku and put into folders named w/ categories, so it’s very easy for me to locate image for any products. However when I test the import feature I found all images were re-imported into random folders and renamed. There’s no rules and no way to tell image file unless check its properties or export a sheet from database. I’m very disappointed about this feature. Not only it’d take much longer time to re-import all images, I’d also lose my very organized structure. I don’t think I will switch to magento until there’s a way to fix this… why not just leave image files where they are instead of importing all?

 
Magento Community Magento Community
Magento Community
Magento Community
 
jballotti
Guru
 
Avatar
Total Posts:  339
Joined:  2008-04-20
Chicago area
 
liz0 - 16 March 2009 12:30 PM

I’v been playing with magento and see if it fits my needs. I like the features I saw and thought I’m going to switch...until I discovered that I have no control on the structure for product images. I have near 3000 products and each has large, regular and thumnails. All images are named according to their sku and put into folders named w/ categories, so it’s very easy for me to locate image for any products. However when I test the import feature I found all images were re-imported into random folders and renamed. There’s no rules and no way to tell image file unless check its properties or export a sheet from database. I’m very disappointed about this feature. Not only it’d take much longer time to re-import all images, I’d also lose my very organized structure. I don’t think I will switch to magento until there’s a way to fix this… why not just leave image files where they are instead of importing all?

What exactly are you looking at??????
When you upload an image to Magento it puts those images into the following directory structure:
MagentoRoot/app/media/catalog/product/(A)/(b)/filename.ext—where (A) is the first letter of the filename and (b) is the second letter of the filename. The name of the file you upload is preserved and not changed at all.

cool smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
guruproj
Sr. Member
 
Total Posts:  76
Joined:  2009-03-16
 
jballotti - 17 March 2009 06:50 AM

liz0 - 16 March 2009 12:30 PM
I’v been playing with magento and see if it fits my needs. I like the features I saw and thought I’m going to switch...until I discovered that I have no control on the structure for product images. I have near 3000 products and each has large, regular and thumnails. All images are named according to their sku and put into folders named w/ categories, so it’s very easy for me to locate image for any products. However when I test the import feature I found all images were re-imported into random folders and renamed. There’s no rules and no way to tell image file unless check its properties or export a sheet from database. I’m very disappointed about this feature. Not only it’d take much longer time to re-import all images, I’d also lose my very organized structure. I don’t think I will switch to magento until there’s a way to fix this… why not just leave image files where they are instead of importing all?

What exactly are you looking at??????
When you upload an image to Magento it puts those images into the following directory structure:
MagentoRoot/app/media/catalog/product/(A)/(b)/filename.ext—where (A) is the first letter of the filename and (b) is the second letter of the filename. The name of the file you upload is preserved and not changed at all.

cool smile

I’m not talking about upload each individual photo. My current platform is creloaded. If I were to switch to magento I will certainly have to find a way to import data. I generated/modified data exported from db to spreadsheet and import to magento via admin. The way I currently name product images is by their sku, image names for large, mid and thumb size are all same but they are in different folders. So there’re 3 sets of image files w/ exactly same names, just in different folders. If I add new products, I also don’t have to browse images etc, simply put in sku as image name.

The import at magento however will take all names and change them to _1, _2 etc. therefore, no way to tell which is which. I’m talking about more than 10,000 photos for 3000 products. If the import can simply take whatever image path I already gave (MagentoRoot/app/media/catalog/product/large/ , ..../mid/, .../thumb/) into db, w/o duplicate/rename/resize, wouldn’t it save much trouble?  The current way of importing I have no idea how long it’s going to take to import them all, EVEN IF I don’t care about file structure.

 
Magento Community Magento Community
Magento Community
Magento Community
 
jballotti
Guru
 
Avatar
Total Posts:  339
Joined:  2008-04-20
Chicago area
 
liz0 - 20 March 2009 05:41 AM

The import at magento however will take all names and change them to _1, _2 etc. therefore, no way to tell which is which. I’m talking about more than 10,000 photos for 3000 products. If the import can simply take whatever image path I already gave (MagentoRoot/app/media/catalog/product/large/ , ..../mid/, .../thumb/) into db, w/o duplicate/rename/resize, wouldn’t it save much trouble?  The current way of importing I have no idea how long it’s going to take to import them all, EVEN IF I don’t care about file structure.

First of all, Magento doesn’t actually store the image files in the database. It only stores a reference to where the file exists on the disk.
Magento doesn’t change the name of the file stored to disk.  While it’s true that that file name you see in the source file of the XHTML has no relationship to the filename uploaded, this is a function of how magento handles images when the XHTML file is created at the server and then delivered to the client. (A mystery to me but it works). The file name on the disk never changes from what you gave it.

Also, when you upload a regular image to Magento using the normal method, it creates the small images and thumbnails it needs for the product and catalog pages. So, you only need one image per product (unless, of course, you want different views of the same product).

I’m curious as to which platform you’re currently using? I know that Magento has conversion scripts for osCommerce and could probably figure out how to convert your current store to Magento. Since you have 3,000 products perhaps the best thing for you to do is call their sales department for a quote.
cool smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
elvar
Member
 
Total Posts:  59
Joined:  2009-01-30
 

So if you have 3000 products you need to request a quote? Do i need to request a quote if i have only 50 products to upload?

I know exactly where is the point of this way of importing… I will do an vba code in excel to create a folder structure in the import file with correct image names and i will solve that problem.

But main question remain: why storing images was designed like that? Any clue? Maybe to request a quote?

 
Magento Community Magento Community
Magento Community
Magento Community
 
jballotti
Guru
 
Avatar
Total Posts:  339
Joined:  2008-04-20
Chicago area
 
elvar - 05 April 2009 01:13 PM

So if you have 3000 products you need to request a quote? Do i need to request a quote if i have only 50 products to upload?

I know exactly where is the point of this way of importing… I will do an vba code in excel to create a folder structure in the import file with correct image names and i will solve that problem.

But main question remain: why storing images was designed like that? Any clue? Maybe to request a quote?

Since I’m not a member of the Magento team and had no part in making design decisions, I’m not the right person to ask that question of. However, I do have more than 30 years of experience working with software engineers designing very complicated software programs in a variety of languages and this is one of the best designed programs I’ve ever seen. Does that mean it can’t be improved? No. And the Magento team is making improvements with every release.

Requesting a quote will, at least, put you in contact with the people who designed the software. Requesting a quote doesn’t mean that you have to actually have them do the work for you. Once you’re in contact with them then you can ask your questions directly of the folks that have the answers you’re looking for. You may or may not get an answer you like, but that’s life, live with it.

cool smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
elvar
Member
 
Total Posts:  59
Joined:  2009-01-30
 

That is a good information… Thanks

I was not referring so much to you as that was just my observations about this structure. And now when you again show up here can you try to find any logical explanation for this design? As experienced software designer!

Lets say you want to upload 1000 images and organize it with local tools for big, small and thumbnail and put all of them in the BIG/SMALL/THUMB sub folders with same names. Then you use csv file to import the products. It can all be very easy developed in the excel. Why this is not first design approach? I really am trying to understand.

 
Magento Community Magento Community
Magento Community
Magento Community
 
jballotti
Guru
 
Avatar
Total Posts:  339
Joined:  2008-04-20
Chicago area
 
elvar - 05 April 2009 11:58 PM

That is a good information… Thanks

I was not referring so much to you as that was just my observations about this structure. And now when you again show up here can you try to find any logical explanation for this design? As experienced software designer!

Lets say you want to upload 1000 images and organize it with local tools for big, small and thumbnail and put all of them in the BIG/SMALL/THUMB sub folders with same names. Then you use csv file to import the products. It can all be very easy developed in the excel. Why this is not first design approach? I really am trying to understand.

First, I am not a software designer or programmer. I’m a support engineer and instructional designer. I create training courses for computer systems, networks, and applications.

Now, as for the reason for the design I can only guess, but my first guess is to create a design that does NOT require the user to create three different sized images for every image they want to use. Take for example my 76 year old mother who has three different online stores. My mother only wants to have to upload one or two pictures for each product on her sites. She doesn’t have the technical knowledge or skills needed to create different sized images from her original photographs. To accommodate a user like my mother you need to have the software automatically create the different sized images it uses from the original uploaded files. This is what Magento does.

Now, you can write your own code to do this, or you can adapt and use existing code that does the same thing making your coding efforts more efficient. I’m pretty certain Magento took the second course and used image editing code/features included with the ZEND/PHP framework. And, it may very well be that it is the built in image editing features that require the directory structure that Magento uses.

However, this is mere conjecture on my part. For a definitive answer you need to ask someone involved in the design decisions.

cool smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
elvar
Member
 
Total Posts:  59
Joined:  2009-01-30
 

In the term of ‘let the Magento creates all versions of the images automatically’ it does not depend on the folder structure design.

It still can do the same as now it does but instead of putting the images like it does now (first letter - second letter) it can store like already described.

In a term of unique names of an images it will be also the same (no losses, no gains) as all image names with same name will be in both versions in the same structure.

But, as we are not members of Magento team we can still just guessing…

 
Magento Community Magento Community
Magento Community
Magento Community
 
dearhunter
Jr. Member
 
Total Posts:  1
Joined:  2010-02-06
 

I could add some thoughts on this design as a software designer, although I’m rather new to magento and php is not one of my top skills. I believe the reason of not to make 3 folders for small, medium and large thumbs is pretty simple - not everyone needs 3 of them. Most people are quite ok with 2 - small and large. Given that magento has zoom feature which shows large image in scrollable view, its pretty much fine.

The manner of placing images in folders by first-second letter is most likely related to performance limitations of some file systems on linux. In some cases you should not place a lot of files in single folder, because performance starts to suffer, and product images are likely to be in large numbers. Magento, being a multiplatform solution, addresses it with file distributing algorithm based on file names.

You have probably found a solution of your issue, but I have one I guess is approriate. You could place your image structure to a folder within magento folder structure and modify image retreival function so that it would look there for images based on SKU. You could also modify image uploading code, but nothing stops you from adding image files manually as well.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Boatmagic
Sr. Member
 
Avatar
Total Posts:  91
Joined:  2010-08-14
 

Image directory structure confusing as ever!

My first product has an ID of 27 (where’s 1??) Product images were uploaded and created in folder ...media/catalog/product/1/0/*.jpg

Second product has ID of 28. Product images were uploaded and created in folder ...media/catalog/product/1/6/*.jpg

Yet 3rd product (ID 29) Product images were uploaded and created in folder ...media/catalog/product/2/5/*.jpg

Why for the love of god didn’t the image structure just befault to one image folder, and instead point the images to that folder to display the images??

Would be so simple! This structure has no reasoning!

 
Magento Community Magento Community
Magento Community
Magento Community
 
saurabh13
Jr. Member
 
Total Posts:  1
Joined:  2011-03-06
 

Hello,
I have import the .csv file from magento with the product details.All products related information shows at frontend but images not appeared.
I have tried to put my image name.jpg with forward slash at image small image and thumbnail column and put image in /media/import folder before importing but its not working.Please help me out that how could i upload images at once with its related products.M using magento ver 1.5.0.1
Thanks.

 
Magento Community Magento Community
Magento Community
Magento Community
 
jmspldnl
Jr. Member
 
Total Posts:  1
Joined:  2011-03-31
 

I have not really worked with Magento yet, but I have worked with several different image structures containing thousands of images.  From a performance perspective, the way they have created the image structure is much better.  Trying to do any file I/O on a folder containing thousands of images will begin to get extremely slow.  You might not be having issues at the 5-10k range, but once you start to hit 100k+ you will have problems.  You need to keep in mind that Magento has been designed to support virtually an unlimited number of products, so they had to design the image structure in a way that would still work with very high numbers of photos.

 
Magento Community Magento Community
Magento Community
Magento Community
 
jlotty22
Jr. Member
 
Avatar
Total Posts:  3
Joined:  2010-07-11
Milwaukee, WI
 

I’m using magento 1.4.1.1 and I just installed a clean version of magento 1.5.0.1....had a problem importing the .csv with products.  Got it to work by setting up my current ftp settings in the Settings >> Import / Export >> Dataflow Profiles>>export all products ......I set my ftp settings to export to public_html/var/export… not sure if having it set to remote ftp will matter or not but it worked for me..

I then downloaded the outputted .csv in my case ProductExport7.csv from the var/export folder in my ftp. 

Next I went to the media/catalog/product folder in magento 1.4....copied all the folders from this directory and placed them in

media/import folder on the magento 1.5 version

ran the dataflow - import all products and BAM!! it worked perfectly

Hope this helps guys, cheers! smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
abhishek1779
Jr. Member
 
Total Posts:  6
Joined:  2011-07-17
 

Hi,

I have 2 stores (like store1.com and store2.com), I have created folder for second store under main root folder of first store. I have added media folder in second store also. If I use media folder for first store, domain name of first comes in image url while viewing image info. That’s why I want to upload images of second store there and set media folder of second store in confguration.

Please suggest me, how we can do that?

Thanks,
Abhishek

 
Magento Community Magento Community
Magento Community
Magento Community
 
Nayan Baraiya
Jr. Member
 
Avatar
Total Posts:  19
Joined:  2011-08-15
 

Thanks James D Ballotti,

Thanks for sharing this it help me a lot to understand how images are stored in different directories...!!!

but one confusion with this is from where magento create this type of directory structure..??? and how it creates cache folder under
media/catalog/product/cache/3/small_image/75x/9df78eab33525d08d6e5fb8d27136e95/s/a/filename.jpg

i want to know how magento create directories for Product Images…

thanks in advance....

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top