Sitefinity ASP.NET CMS - Content Management System

KB Article

Home >  Support >  Knowledge Base >  KB Article
How to add description to images in the Images & Documents module - ID#963
Rating:
Last Modified: 4/9/2008
Related categories: Modules;

Article information

Article relates to

 Sitefinity 3.2

Created by

 Vassil Daskalov


By default, you are able to add Description to items in the Custom and Document library types. However, this option is not available for the Image library items.
Adding a description to images is a pretty easy task and can be achieved in three steps:

1. Add the Description meta field for the Image library type. The needed meta field is already declared in the database and set to be used for the Custom and Document library types. This is why, you only need to set it to for the Image library type in the application web.config like this:

<libraries defaultGenericProvider="Libraries">     
 ...     
    <libraryInfo>     
        <add name="Image" title="Image Library" defaultExtenstions=".png, .jpg, .jpeg, .gif" metaKeys="Description, Author, AlternateText, Extension, Name, Height, Width, Size, Category"></add>     
        <add name="Document" title="Document Library" defaultExtenstions=".doc, .docx, .rtf, .txt, .pdf, .ppt, .pptx, .html, .xls, .xlsx" metaKeys="Author, Description, Extension, Name, Size, Category"></add>     
        <add name="Custom" title="Custom Library" defaultExtenstions=".*" metaKeys="Author, Description, Extension, Name, Size, Category"></add>     
    </libraryInfo>     
</libraries>    

2. Open the ~/Sitefinity/Admin/ControlTemplates/Libraries/ControlPanelEdit_Image.ascx template and add a TextBox with ID equal to the name of the meta field, that is, "Description". Be careful to add this control inside the ContentMetaFields control:

<sfGCn:ContentMetaFields ID="editMetaFields" runat="server">  
 <ItemTemplate>  
  ...  
  <li>  
   <asp:Label ID="Label5" runat="server" AssociatedControlID="Description" Text="Description: "></asp:Label>  
   <asp:TextBox runat="server" ID="Description" TextMode="MultiLine"></asp:TextBox>  
  </li>  
  ...  
 </ItemTemplate>  
</sfGCn:ContentMetaFields> 

The result should look like this:

Description meta field

3. Open the template used by the Image Gallery control and add a Label so that the description is displayed in the public part. For example, if the control is set to show the images in List & Page mode, you need to add an ITextControl field with ID "Description" in the ~/Sitefinity/ControlTemplates/Libraries/GalleryListViewTemplate.ascx template.

Descriotion: public part


Article Comments

James TheGeek, 5/6/2008
Thanks for this article, but I think we are still missing an item - when I click on edit image gallery to select what gallery to pull from and go to step 3 selecting what items to show, it does not give me a choice for selecting "Description". Please advise.

Telerik Admin, 5/21/2008
To display Description at the Gallery settings step of the sliding wizard in the Image Gallery control: 1.Open~/Sitefinity/Admin/ControlTemplates/Libraries/GalleryControlDesigner.ascx file and add CheckBox control(s) for Description. 2.Open~/Sitefinity/Admin/ControlTemplates/Libraries/App_LocalResources/GalleryControlDesigner.ascx.resx and add the necessary resource.

Angela Walker, 9/3/2008
perfect thx!


Please Sign In to rate this article or to add it to your favorites.