I'm having an issue trying to save gallery files to the file system. I have tried just changing the "enableFileSystemStorage" attribute to true in the gallery key, but it still saves the photos to the database. If I change the "enableFileSystemStorage" attribute to true in the AttachmentSettings and CacheSettings entries, the files won't upload properly. If I upload an image with those settings set, it seems like it uploads the file, but then it displays a broken image for the picture. Is this a known bug, or am I missing a setting somewhere? Other users seem to be having the same issue.
Thanks,Martin
<Gallery enableFileSystemStorage="true" fileSystemStorageLocation="~/photos/storage" cacheStorageLocation="~/photos/cache" allowEncodedUnicodeCharsInMetadata="true">
It could be permissions...If you are running XP make sure the ASPNET user has write access to the blogs and photos gallery, or if you have 2K then ensure you have these settings for the NETWORKSERVICE account.
Hope this helps.
If not what error is logged in the reports section?
I'm experiencing the same problem with 2.0.51107.1266. The error logged when trying to display one of the file-based images is:
User Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLRPath: /CS/photos/viewPicture.aspx?App=january_2005&PostID=7 as HTTP GETReferrer: /CS/photos/january_2005/default.aspxMessage: Object reference not set to an instance of an object.System.NullReferenceException: Object reference not set to an instance of an object.at CommunityServer.Galleries.Components.GalleryUrls.PictureUrl(GalleryPost galleryPost)at CommunityServer.Galleries.Controls.PictureDetails.DataBind()at System.Web.UI.Control.DataBind()at System.Web.UI.Control.DataBind()at System.Web.UI.Control.DataBind()at System.Web.UI.Control.DataBind()at System.Web.UI.Control.DataBind()at System.Web.UI.Control.DataBind()at System.Web.UI.Control.DataBind()at System.Web.UI.Control.DataBind()at System.Web.UI.Control.DataBind()at System.Web.UI.Control.DataBind()at CommunityServer.Controls.TemplatedWebControl.DataBind()at CommunityServer.Galleries.Controls.LayoutTemplate.DataBind()at CommunityServer.Galleries.Controls.LayoutTemplate.OnLoad(EventArgs e)at System.Web.UI.Control.LoadRecursive()at System.Web.UI.Control.LoadRecursive()at System.Web.UI.Control.AddedControl(Control control, Int32 index)at System.Web.UI.ControlCollection.Add(Control child)at CommunityServer.Galleries.Controls.GalleryThemedControl.CreateChildControls()at System.Web.UI.Control.EnsureChildControls()at System.Web.UI.Control.PreRenderRecursiveInternal()at System.Web.UI.Control.PreRenderRecursiveInternal()at System.Web.UI.Page.ProcessRequestMain()
The photos are present in the storage folder, but they do not render properly. Also, images added prior to setting enableDataStoreStorage = "false" are still displayed as expected.
http://ServerName/CS/ControlPanel/Tools/Reports/ExceptionsReport.aspx
or you can reach it by
Settings | System | Reports
[NullReferenceException: Object reference not set to an instance of an object.] CommunityServer.Galleries.Controls.PictureDetails.BindData() +229 CommunityServer.Galleries.Controls.PictureDetails.AttachChildControls() +585 CommunityServer.Galleries.Controls.GalleryThemedControl.CreateChildControls() +170 System.Web.UI.Control.EnsureChildControls() +100 CommunityServer.Controls.TemplatedWebControl.DataBind() +12 CommunityServer.Galleries.Controls.PictureDetails.DataBind() +45 System.Web.UI.Control.DataBind() +86 System.Web.UI.Control.DataBind() +86 CommunityServer.Controls.TemplatedWebControl.DataBind() +19 System.Web.UI.Control.DataBind() +86
-Alex LoweCommunity Server, Evolution, and Harvest Documentation
bump...
I had a problem with a ballooning database since all my uploaded images since V2.0B1 were being stored both in the database and on the filesystem. Even setting <Gallery><AttachmentSettings enableDataStoreStorage = "false" /> didn't work as I got the same error as jason_looney above.
Here's a script I wrote that clears the Content columns of my cs_PostAttachments since these are already on my filesystem - i.e. i only want them stored once. Hopefully someone will find this useful and can modify it to their needs. Note that this may delete content that is stored only in the database.
set nocount on--Find rows with Content columns that need to be cleared since they're already on the filesystemselect PostID, DataLength(Content)'ContentLength'into #tempfrom cs_PostAttachmentswhere DataLength(Content) > 0order by PostID desc
--required variablesdeclare @ptrval binary(16) declare @PostID intdeclare @ContentLength int
--loop through temptable to find PostIDs and ContentLengthsdeclare mycursor cursor fast_forward for select PostID, ContentLength from #temp
open mycursorfetch next from mycursor into @PostID, @ContentLengthwhile @@fetch_status = 0begin select @ptrval = TEXTPTR(Content) from cs_PostAttachments where PostID = @PostID UPDATETEXT cs_PostAttachments.Content @ptrval 0 @ContentLength fetch next from mycursor into @PostID, @ContentLength endclose mycursordeallocate mycursor
drop table #temp
--now shrink the db and allow 10% free space in MDF fileDBCC SHRINKDATABASE (CommunityServer, 10)
This could also delete photos that are only stored in the database.
I have about 200 that I need to move out of the database and into the filesystem.
Looking at the DB, there are a few distinguishing factors
Only Stored in the Database : FriendlyFileName IS NULL, Height=0, Width=0
CS2B1 : Stored in Both Locations : NOT FriendlyFileName IS NULL, Height>0, Width>0
1) Always make a backup before you get your hands dirty.
2) Check Step1.
MrVJTod wrote: This could also delete photos that are only stored in the database. I have about 200 that I need to move out of the database and into the filesystem.
right. sorry. i'll edit my post to be more specific to my situation. i want ALL my photos on my filesystem.
Ok here goes... Photos only on the filesystem was broken in CS 2 b1 and would result in missing records in the cs_PostAttachements table... (all the posts were going in as PostID 0)...
In B2 it looks like the PostID0 record is still being created (but is harmless for all practical purposes)... This has been logged as a bug...
Additionally the correct record is written to the cs_PostAttachements table... each post saved in the filesystem only configuration, will overwrite the PostID 0 record, and add a new record with the correct postid in B2...
The ContentSize, Height and Width all must be greater than zero. The only difference between photos saved with enableDataStoreStorage true vs false is the Content field... which in the latter case is set to 0x
To remove files from the database, just view them with enableFileSystemStorage set to true, the system will automatically make the correct files... once you have them on your web server, you should just set the Content col to 0x (binary) and set enableDataStoreStorage to false on the AttachementSettings block
No changes other than the physical location are supported on the CacheSettings at this time.
Dan, thanks. This does provide some good insight.
I can see the file created in Storage when it gets viewed. That makes things easy for me. I can join the cs_PostAttachments with cs_Sections to create urls to view my DB-Only pictures.
I see with B2, there is a new file naming scheme as well and that file names are updated when they are first viewed. 1000.3.3836 becomes 1000.3.3836.OriginalFileName.
Looking through my DB, only posts made with B1 and B2 have a height and width > 0. All of my old photos have Height=0 and Width=0. All my photos do have ContentSize>0.
DanBartels wrote: To remove files from the database, just view them with enableFileSystemStorage set to true, the system will automatically make the correct files... once you have them on your web server, you should just set the Content col to 0x (binary) and set enableDataStoreStorage to false on the AttachementSettings block
Just so I'm sure that I understand, if both enableFileSystemStorage and enableDataStoreStorage have both always been set to true, then will all the files already be in place on the file system? If so, then as I see it all that needs to be done are the changes outlined above to the Content column and the enableFileSystemStorage setting and the photos will be stored only on the file system. Is this correct?
Thanks in advance for your help,
Alun
Yes, that is correct... That is sort of the thinking behind the current defaults; is when you have a preference, you can make the change and all your existing photos should continue to work...
Of course, I am going to suggest you have a backup of the database and \storage location before changing anything (this is beta software after all)....
Dan
DanBartels wrote:Ok here goes... Photos only on the filesystem was broken in CS 2 b1 and would result in missing records in the cs_PostAttachements table... (all the posts were going in as PostID 0)... In B2 it looks like the PostID0 record is still being created (but is harmless for all practical purposes)... This has been logged as a bug... Additionally the correct record is written to the cs_PostAttachements table... each post saved in the filesystem only configuration, will overwrite the PostID 0 record, and add a new record with the correct postid in B2... The ContentSize, Height and Width all must be greater than zero. The only difference between photos saved with enableDataStoreStorage true vs false is the Content field... which in the latter case is set to 0x To remove files from the database, just view them with enableFileSystemStorage set to true, the system will automatically make the correct files... once you have them on your web server, you should just set the Content col to 0x (binary) and set enableDataStoreStorage to false on the AttachementSettings block No changes other than the physical location are supported on the CacheSettings at this time.
Copyright© 2008 Telligent Systems Inc. All rights reserved CommunityServer.com • Telligent.com