Copied to clipboard

Flag this post as spam?

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


  • Dav 44 posts 69 karma points
    May 30, 2011 @ 15:16
    Dav
    0

    Where in code does Umbraco generate thumbnails?

    Been drowning in code for a while and I'm stuck. We'd like to change the thumbnail generation code so that it can properly handle PNG32 files with opacity, and at the same time learn something new about Umbraco. We quickly came across UmbracoImageMediaFactory and the GenerateThumbnail method inside... only to put the celebratory cake away minutes later.

    No matter what we do inside the GenerateThumbnail method, it doesn't seem to get called at all. In fact, VS2010 finds no usings of the UmbracoImageMediaFactory class! We resorted to putting throw new Exception(s) around, and they too don't pop up whenever we save an image.

    It seems that code goes through umbraco.cms.businesslogic.media.Media.Save... but these are general media-related methods.

    Curiosity is eating us bad now - where does v4.7 generate the actual thumbnails? Any pointers will be more than welcome!

  • Dav 44 posts 69 karma points
    May 30, 2011 @ 15:26
    Dav
    0

    Eureka! Found it in a moment of revelation: a search for "Graphics" revealed the culprit... if you ever need to have your jpg thumbnails display PNGs on a white background (a little saner than the default black), just add g.Clear(Color.White) around line 318 in umbraco.editorControls.uploadField.generateThumbnail(...).

  • Ian 32 posts 82 karma points
    Feb 26, 2013 @ 18:24
    Ian
    0

    Which version of the uploadField are you referring to? There's this one in the Umbraco source...

    http://umbraco.codeplex.com/SourceControl/changeset/view/1a8fa0763133#src/umbraco.editorControls/uploadfield/uploadField.cs

    Its not easy to duplicate due to its dependencies.

    Then I found this one...

    http://www.51aspx.com/CodeFile/Umbraco/components/editorControls/uploadfield/uploadField.cs.html

    .. by googling, 'umbraco.editorControls.uploadField.generateThumbnail' (from your post).

    But that doesn't contain 318 lines!

    Confused!

  • Bipin Kataria 29 posts 60 karma points
    Jul 26, 2016 @ 01:35
    Bipin Kataria
    0

    If you want thumbnail in Media section for SVG file, just add below code in umbracoSettings.config > Content tag:

    <imaging>

    <!-- what file extension that should cause umbraco to create thumbnails -->

    <imageFileTypes>jpeg,jpg,gif,bmp,png,tiff,tif,svg</imageFileTypes>

    </imaging>

Please Sign in or register to post replies

Write your reply to:

Draft