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!
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(...).
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!
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(...).
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!
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>
is working on a reply...