How do I move the existing pictures stored in database to file system, after changing the setting Pictures to be stored to File System?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
11 years ago
I was trying this in version 1.7

Changed Admin>Configuration>AllSettings>Media.Images.StoreinDB to 'false'
lost all pictures from site

did the DBCC SHRINKDATABASE ('YOUR_DB_NAME_HERE') trick
database shrank from 409MB to 170MB

Changed Admin>Configuration>AllSettings>Media.Images.StoreinDB to 'true'
images came back

Not sure if the SHRINKDATABASE trick would have worked anyway but I would try that first otherwise I would have had to re-upload hundreds of photos.
9 years ago
I've to do this configuration change in 3.2 version.

When I click the "change" button, I got a generic error.

How can I troubleshoot it?
9 years ago
UP!
9 years ago
Hi,

If the pictures are stored in the file system and not in the VARBINARY field where/how is the correlation between a product and a picture being made?  I know the files are renamed with the ID of the picture, and that they are being stored as some combination of the site url with what appears to be a hashed value.

Any help?

Thanks in advance.
7 years ago
jjohns01 wrote:
Hi,
If the pictures are stored in the file system and not in the VARBINARY field where/how is the correlation between a product and a picture being made?  I know the files are renamed with the ID of the picture, and that they are being stored as some combination of the site url with what appears to be a hashed value.
Any help?
Thanks in advance.


I'd really like to hear the answer to this question. Regarding a 3.6 nop site.
7 years ago
Scotter wrote:

jjohns01 wrote:
Hi,
If the pictures are stored in the file system and not in the VARBINARY field where/how is the correlation between a product and a picture being made?  I know the files are renamed with the ID of the picture, and that they are being stored as some combination of the site url with what appears to be a hashed value.
Any help?
Thanks in advance.

I'd really like to hear the answer to this question. Regarding a 3.6 nop site.

In the Product_Picture_Mapping table (though this is true regardless of whether images are stored in the database or file system).
7 years ago
petemitch wrote:

Hi,
If the pictures are stored in the file system and not in the VARBINARY field where/how is the correlation between a product and a picture being made?  I know the files are renamed with the ID of the picture, and that they are being stored as some combination of the site url with what appears to be a hashed value.
Any help?
Thanks in advance.
I'd really like to hear the answer to this question. Regarding a 3.6 nop site.
In the Product_Picture_Mapping table (though this is true regardless of whether images are stored in the database or file system).


Thanks for the reply.
Here is another issue I'm having that I hope you can give insight on.
In my 3.6 nopCommerce site, I have images stored in the file system.
I see, for an image named like: 0000020_care-builders-at-home_207.png
The only clues I have as to how to find that file name programmatically are
[Picture].SeoFilename = "care-builders-at-home"
[Picture].MimeType = "image/png" or "image/jpeg"

And by "programmatically" I mean a phone app I'm building that can access the database but needs an exact file name. Ideas?

Thanks!
7 years ago
Scotter wrote:
Here is another issue I'm having that I hope you can give insight on.
In my 3.6 nopCommerce site, I have images stored in the file system.
I see, for an image named like: 0000020_care-builders-at-home_207.png
The only clues I have as to how to find that file name programmatically are
[Picture].SeoFilename = "care-builders-at-home"
[Picture].MimeType = "image/png" or "image/jpeg"

And by "programmatically" I mean a phone app I'm building that can access the database but needs an exact file name. Ideas?

Thanks!

The GetPictureUrl function in the PictureService shows how nop builds the filename. There are a few variations but they end up with something like:

string.Format("{0}_{1}_{2}.{3}", picture.Id.ToString("0000000"), seoFileName, targetSize, lastPart)

Though if you're building a phone app the it doesn't make sense to try and replicate this functionality in the app. Assuming you're using some sort of API to get the nop data to the app it would make more sense to have the API generate the correct image urls and just pass them to the app.
6 years ago
a.m. wrote:
They're automatically moved to the file system when you change the "Pictures to be stored on" setting


Andrei, can you tell me what is better: to store images in DB or in File directories?

Thanks :)
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.