crosspost from http://rextang.net/blogs/work/
Just had a trace to the source code since I found some of my gallery photos were missing and not able to get them back while upgrading my blog site to CS 2.1 in my VM.
Later found that in .Text era, images were saving to DB only; later in CS 1.x era, images were changed to save to files to minimize DB space usage. now in CS 2.1 , it can now be set to either places, or both.
in CS 1.x , the default image saving location is at ~/photos/storage , while it's the same as in CS 2.1 , if you find your images missing to display on browser, remember to copy all the files in ~/photos/storage of CS 1.x web spaces.
in CS 2.1, now there are options to let you set where to save, DB or file, or both. refer to default CommunityServer.config file , like the following:
extensions = "gif,jpg,jpeg,png,bmp,GIF,JPEG,JPG,PNG,BMP,Gif,Jpg,Jpeg,Png,Bmp" />
AttachmentSettings is the place to toggle where to save images to. if set both enableFileSystemStorage and enableDataStoreStorage to true, not only image files will be create and save in ~/photos/storage folder, but also will be saved to database record binary field (cs_PostAttachment table). Refer to GalleryPosts.cs file of CommunityServerGalleries20 project (started from line 387):
//TODO: work on new save attachement patterns
private static void CreatePictureData(GalleryPost galleryPost, PostAttachment pictureData)
// Submit it to the database
if (GalleryConfiguration.Instance().AttachmentSettings.EnableDataStoreStorage && pictureData.HasDateCreated)
PostAttachment noPictureData = new PostAttachment(pictureData);
noPictureData.Content = null;
// If file system storage is enabled, we need to save it.
basically this checks both flags to see if they are true, and then save to each places (DB and file). but if DataStoreStorage flag is false, then while saving the data record, will set Content binary field to null.
By default setting in CS 2.1 , it seems set both DB and file flags to true. To preserve the same usage as in CS 1.x , it's needed to change the enableDataStoreStorage to false.
CacheSettings also using the same setting pattern as AttachmentSettings, but actually DataStore support for Cache is currently not supported in this version, as stated in the comment of CommunityServer.config file.
Technorati Tags: communityserver , asp.net , programming