Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hello world!
I'm trying to create an handler for retreiving thumbnails for pdf files. This is what i've got so far:
public class PdfThumbnailProvider : AbstractThumbnailProvider { protected override IEnumerable<string> SupportedExtensions { get { return new List<string> { ".pdf" }; } } protected override bool TryGetThumbnailUrl(string fileUrl, out string thumbUrl) { // Set thumbnail url to empty strin initially thumbUrl = string.Empty; // Make sure file has an extension var ext = Path.GetExtension( fileUrl ); if( string.IsNullOrEmpty( ext ) ) return false; // Make sure it has a supported file extension if( !IsSupportedExtension( ext ) ) return false; // Make sure the thumbnail exists var tmpThumbUrl = fileUrl.Replace( ext, "_thumb.jpg" ); try { var fs = FileSystemProviderManager.Current.GetFileSystemProvider<MediaFileSystem>(); var relativeThumbPath = fs.GetRelativePath( tmpThumbUrl ); if( !fs.FileExists( relativeThumbPath ) ) return false; } catch( Exception ) { // If something odd happens, just return false and move on return false; } // We've got this far, so thumbnail must exist thumbUrl = tmpThumbUrl; return true; } }
But this isn't working, what am i missing?
I've based in on this source: https://github.com/umbraco/Umbraco-CMS/blob/dev-v7/src/Umbraco.Web/Media/ThumbnailProviders/ImageThumbnailProvider.cs
Best regards Rasmus E.
-- UPDATE:
Found the following ThumbnailProvidersResolver, but it turns out this is internal sealed and not public sealed like the ContentFinderResolver
I've created a pull-request here: https://github.com/umbraco/Umbraco-CMS/pull/751
And issue here: http://issues.umbraco.org/issue/U4-6902?query=ThumbnailProvider
The pull-request has been accepted and is now due in v7.3.0
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Custom ThumbnailProvider not working?
Hello world!
I'm trying to create an handler for retreiving thumbnails for pdf files. This is what i've got so far:
But this isn't working, what am i missing?
I've based in on this source: https://github.com/umbraco/Umbraco-CMS/blob/dev-v7/src/Umbraco.Web/Media/ThumbnailProviders/ImageThumbnailProvider.cs
Best regards Rasmus E.
-- UPDATE:
Found the following ThumbnailProvidersResolver, but it turns out this is internal sealed and not public sealed like the ContentFinderResolver
I've created a pull-request here: https://github.com/umbraco/Umbraco-CMS/pull/751
And issue here: http://issues.umbraco.org/issue/U4-6902?query=ThumbnailProvider
The pull-request has been accepted and is now due in v7.3.0
is working on a reply...