Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Fredrik Esseen 610 posts 906 karma points
    Nov 18, 2010 @ 10:58
    Fredrik Esseen
    0

    Create thumbnails

    Hi!

    ive added a thumbnail size on the Upload datatype.

    Is it possible for the uploadify to create the thumbnail that I entered? or how can i do that?

    The Desktop Media uploader seems to use the Upload because with that one it works.

  • Eduardo 106 posts 130 karma points
    Nov 18, 2010 @ 11:24
    Eduardo
    0

    Hi froad, 

    I created a document type for handling images, I select the image file with media upload and then, just after publishing the document, I create a thumbnail maintaining the image aspect ratio.

    1. Implement an event handler in a new class that inherits from ApplicationBase:

    public class ApplicationBases : ApplicationBase
    {               
    public ApplicationBases()
    {
    //Declare handler
              Document.AfterPublish += new Document.PublishEventHandler(Document_AfterPublish);
    }


     

    2. Write the handler function:

    This function will retrieve the image name, load this image and create a new copy with the given dimensions.


    void Document_AfterPublish(Document sender, umbraco.cms.businesslogic.PublishEventArgs e)
    {
         if (sender.ContentType.Alias == "yourdocument")
         {
              if(   sender.getProperty("imagepropertyofdocument").Value != null )
             {
    var dimension = sender.getProperty("thumnailsize").Value
    resizefile(sender.getProperty("imagepropertyofdocument").Value,dimesion); }
    }
    }
    }

     

     

    The chosen image file is stored in a new media directory with a copy of the image in thumbnail format.

    Is this what you are looking for?

    HTH.

    Sincere regards,
    Eduardo Macho

  • Connie DeCinko 931 posts 1160 karma points
    Feb 07, 2011 @ 19:40
    Connie DeCinko
    0

    So, then how do I display the thumbnail when I click the media item?  If I take away the Upload file property, then how do I display a thumbnail in the backend?

     

Please Sign in or register to post replies

Write your reply to:

Draft