Ideas and Thoughts on Images and Documents

Charles Matvchuk asked on April 7, 2015 18:52

Looking for some opinions. Here is the current scenario. I am running version 8.2 and I have two databases. One for Kentico and One for Images only. It contains only 1 table. The images table holds both a thumbnail and the image in a varbinary(Max) field for each. I get the DocumentID, CreatedBy, Author and DocumentName through the API when the image is uploaded by an end user through a custom web part which is a custom .ascx control. I also use the Kentico API to size the images and get settings from Kentico settings. To view the images I use a custom web part that displays them in gallery format.

I currently have 600,000 images. Some Pages(Documents) have no images some have 100's of images. All the images are typically uploaded by the members of the site. Performance is good and there are no issues.

The problem or concern, is that anytime the custom upload form or custom display webpart (grid list) needs to change then I have to open the code to do it. It would be so much easier using transformations and alternative forms, etc. etc.

I have thought about using attachments and I also have thought about creating a custom page type (Document Type) and allowing users to upload their images. Obviously if I integrate it, then the restful and API is available which is a big plus, otherwise I need to custom code each.

Looking for thoughts and opinions on the matter.

Thanks in advance.

Correct Answer

Brenden Kehren answered on April 9, 2015 01:46

You can if you edit the resource value to show it in development mode and update the class then clear your cache, you should be able to add it within the UI. Its a bit more work but it makes sure it's done right vs. manually.

select *
from CMS_Resource
where ResourceDisplayName like '%page%'

update CMS_Resource
set ShowInDevelopment = 1, ResourceIsInDevelopment = 1
where ResourceID = 339

select *
from CMS_Class
where classname like '%attach%'

update cms_class
set ClassShowAsSystemTable = 0, ClassIsCoupledClass = 1
where ClassID = 504

This will get you the "Pages" resource and then you can get to the Attachment class.

0 votesVote for this answer Unmark Correct answer

Recent Answers

Brenden Kehren answered on April 7, 2015 19:04

I use document attachments for something like this. You can then in your transformation to display the page/doc type info, you can use the attachments viewer and get all the attachments for that page/document. You could also use related docs and categories to set taxonomy related items. It does work pretty slick and seems like that's what you're ultimately doing with the other single table. Not only do you get the RESTful and API usage, you also get searching abilities too.

0 votesVote for this answer Mark as a Correct answer

Charles Matvchuk answered on April 7, 2015 19:10 (last edited on April 7, 2015 19:16)

I was thinking along the same lines. Related Docs, Categories, Search and Taxonomy are huge pluses. When we started developing the site the image store was already available, now I feel it is time to integrate it.

How would you go about allowing users to just upload images as attachments ? They do not have access to back end. Right now I have a custom web part that I would have to modify to use the attachments API. Unless there is a simpler way, I really couldn't build one out of the stock web parts.

Also if I wanted to capture UserID of uploaded user, should I just mod the Attachment table ?

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on April 8, 2015 19:03

Regarding the uploading of attachments, I'd guess you could get some ideas from the /CMSModules/Content/Controls/Attachments files. They should have something you can at least clone and modify to your liking to be used externally.

Regarding the UserID on the Attachments, I'd go through the UI and add the field but yes, I'd guess that would probably be the best place for it.

0 votesVote for this answer Mark as a Correct answer

Charles Matvchuk answered on April 8, 2015 19:20

Brenden, unfortunately you cannot add a field through the UI to attachments class in the module. Even if I over ride it as a system table in the class table. Kentico V 8.2

0 votesVote for this answer Mark as a Correct answer

Charles Matvchuk answered on April 9, 2015 21:45

Thanks, it worked.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.