I have a website that is going to host a large number of PDF files. I am going to set things up so that, when a PDF is uploaded using the PDF media type that I've created, a thumbnail image of its first page is generated using Ghostscript, and saved in the same folder as the file, with the extension "_thumb", just like Umbraco does automatically for image files.
The problem I have is that when a "..._thumb.jpg" file is added to the media folder of a PDF, the new FolderBrowser data type doesn't use it. I looked through the Umbraco source code, and found the code responsible for choosing the thumbnail images: For files with the extensions .jpeg, .jpg, .gif, .bmp, .png, .tiff, or .tif, the file ImageThumbnailProvider is used. It looks for a file with the name "[upload's filename]_thumb.jpg" in the same folder as the file (just like I want), but only for the file extensions it lists. For files with other file extensions, other ThumbnailProviders (1, 2) are used that choose more generic thumbnail images.
I'm pretty sure that if I could just add '.pdf' to the list of supported file extensions in the ImageThumbnailProvider.cs file, it would start using my PDF thumbnails, but I have no idea how I could change this code. Alternatively, if I could just add a modified version of ImageThumbnailProvider as an additional Thumbnail Provider, I think that would fix my problem as well. Does anyone know how I might be able to modify or add new image thumbnail providers, so PDF thumbnails will get used in the Folder Browser data type?
Editing/adding media ThumbnailProviders?
I have a website that is going to host a large number of PDF files. I am going to set things up so that, when a PDF is uploaded using the PDF media type that I've created, a thumbnail image of its first page is generated using Ghostscript, and saved in the same folder as the file, with the extension "_thumb", just like Umbraco does automatically for image files.
The problem I have is that when a "..._thumb.jpg" file is added to the media folder of a PDF, the new FolderBrowser data type doesn't use it. I looked through the Umbraco source code, and found the code responsible for choosing the thumbnail images: For files with the extensions .jpeg, .jpg, .gif, .bmp, .png, .tiff, or .tif, the file ImageThumbnailProvider is used. It looks for a file with the name "[upload's filename]_thumb.jpg" in the same folder as the file (just like I want), but only for the file extensions it lists. For files with other file extensions, other ThumbnailProviders (1, 2) are used that choose more generic thumbnail images.
I'm pretty sure that if I could just add '.pdf' to the list of supported file extensions in the ImageThumbnailProvider.cs file, it would start using my PDF thumbnails, but I have no idea how I could change this code. Alternatively, if I could just add a modified version of ImageThumbnailProvider as an additional Thumbnail Provider, I think that would fix my problem as well. Does anyone know how I might be able to modify or add new image thumbnail providers, so PDF thumbnails will get used in the Folder Browser data type?
Thanks,
David Zweben
is working on a reply...