+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / how to upload thumbnail images in "Images & Document" section

how to upload thumbnail images in "Images & Document" section

8 posts, 0 answered
  1. gopalraman gopal
    gopalraman gopal avatar
    52 posts
    Registered:
    03 Dec 2009
    08 Jun 2010
    Link to this post
    Hi

    In "Images & Documents" module, while uploading a document it is possible to add thumbnail image for the uploading document?


    Thanks
    G.GopalRaman
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    09 Jun 2010
    Link to this post
    Hello gopalraman gopal,

    There is not functionality out of the box. The images are generated during upload inside UploadFile public method which cannot be overridden. So, you could create a custom uploader and replace the default one in LibraryItemUpload view or generate the images later - after the content item has been uploaded. To generate the thumb from a document you should use an external library like Aspose.PDF.kit
    or iTextSharp.

    Basically the steps are

    • get reference to page - zero based index
    • get dimensions of page a
    • copy current page to clipboard as image
    • get image from clipboard as bitmap
    • calculate width and height
    • draw the image using Bitmap.

    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. gopalraman gopal
    gopalraman gopal avatar
    52 posts
    Registered:
    03 Dec 2009
    09 Jun 2010
    Link to this post
    Hi Ivan Dimitrov

    Thanks for your reply.

    I dont want to get a thumnail image from the pdf. I want to add new fileupload control , while adding a document in "Images & Documents" module i need to add a thumnail image externally.

    It is possible?


    Thanks
    G.GopalRaman
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    09 Jun 2010
    Link to this post
    Hello gopalraman gopal,

    We do not have API that you can use to generate thumbs for document items. You need to use external libraries as suggested. We have API that generates thumbs only for image and videos. Since you are going to do this for documents( PDF is also document ) you have to find an external library that can generate the thumb.

    I hope that helps.

    Kind regards,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  5. gopalraman gopal
    gopalraman gopal avatar
    52 posts
    Registered:
    03 Dec 2009
    10 Jun 2010
    Link to this post
    Hi Ivan ,

    I understood what you told, but i am not meaning that. i want to add a fileupload control separately in "Images & Dcouments" to add a image externally by user, for that i need to configuring in sitefinity. I want to know how to configure it in "Images & Dcouments" module.

    Thanks
    G.GopalRaman
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    10 Jun 2010
    Link to this post
    Hi gopalraman gopal,

    You could map one of the external templates - say LibrryItemEdit.ascx or LibraryItemUpload.ascx ( How to map a template) and implement your logic there. Another option is replacing the default view and integrating your control in directly in the view instead of the template.

    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  7. Kieran
    Kieran avatar
    56 posts
    Registered:
    14 Aug 2008
    23 Aug 2010
    Link to this post
    Sorry this just starting working all of a sudden.



    Hi Ivan

    I am trying something similar.


    I have created an external template for "LibraryItemEdit.ascx"

    Added

     

    <li class="selector"
      
    <asp:Label ID="Label9" AssociatedControlID="DocImage2" runat="server"><asp:Literal ID="Literal28" runat="server" Text="Image"></asp:Literal> <em id="Em2" runat="server"></em></asp:Label
      
    <uc:LibrarySelector ID="DocImage2" runat="server" DisplayMode="Image"></uc:LibrarySelector
      
    </li

    Updated the web.config with

     

     

    <add key="Libraries.DocImage2" valueType="ShortText" visible="True" searchable="True" sortable="True" defaultValue="" />  
      
      
    <add name="Document" title="Document Library" defaultExtenstions=".doc, .docx, .rtf, .txt, .pdf, .ppt, .pptx, .html, .xls, .xlsx" metaKeys="Author, Description, Extension, Name, Size, Category, DocImage2"></add>

    I can add the image to the document in the admin area.

    My issue is with displaying this image in the download list.
    I have pointed the download list control to my template.

    <asp:PlaceHolder ID="ThumbnailHolder" runat="server">
                    <p class="sf_newsThumbnail">
                        <img src="<%# Eval("Libraries.DocImage2") %>" /></p>
                </asp:PlaceHolder>

    I get this error
    DataBinding: 'Telerik.Cms.Engine.Data.CmsContentBase' does not contain a property with the name 'DocImage2'.



    When I display the value of DocImage2 in a literal
    <asp:Literal ID="DocImage2" runat="server" />

    It displays the link to the image.

    thanks
    Kieran




     

  8. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    23 Aug 2010
    Link to this post
    Hi Kieran,

    You cannot use Eval, because the metakey you have created is not part ofCmsContentBase object and there is no such data fields in the data source. You have to set the value manually bu overriding DownloadList control - SetItemMetadata method. From the itemContainer parameter you can access your control. From the second parameter of the method IContent object. you can access your metakey called DocImage2 and set its value as Image src attribute. You can use the server ASP.NET Image control instead the HTML img.

    Kind regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Register for webinar
8 posts, 0 answered