Hi Friends,
Is it possible to use the File Types Editor to add PDF as an image file? I suppose PDF can only be either a document or image?
I tried to set up as image file, but it doesn't seem to work. I don't know if I set it up wrong, or if it's just not possible.
In File Types Editor dialog, I put:
File extension -- pdf
MIME type -- image/pdf
Content type -- image
player -- no player
Sorry if this seems obvious to some of you. But I don't completely understand how everything works.
Thanks for your help :)
Sorry. On 2nd thought, I decided maybe I should clarify what I meant by "doesn't seem to work".
When I try to upload a PDF, I get an error that says "The file you have uploaded is not a valid image!"
What exactly do you want to achieve? PDF files are no images: http://en.wikipedia.org/wiki/Portable_Document_Format
I want to be able to upload PDF images, into my CPG. PDF can contain both raster or vector graphics (or both). In the case of my gallery, which is to display graphics made with Inkscape (a vector graphics editor), it would be mostly vector content. But whether it's raster or vector shouldn't matter. Just that PDF is a graphics format, and I'd like to be able to upload PDF files as images.
Here you can see that PDF is listed as a graphics file format: https://en.wikipedia.org/wiki/Comparison_of_graphics_file_formats
Let's see if I can attach an example....
While PDF is listed in the link you provided - its 'MIME type' even in that document is 'application/pdf' - and not 'image/pdf'
While 'MIME type' originated with email - it is also know as Content Type and used to determine what program/handler to open a file.
https://en.wikipedia.org/wiki/Internet_media_type (https://en.wikipedia.org/wiki/Internet_media_type)
No image program will know how to handle 'image/pdf'
I expect the error from CPG is when either Imagemagick or GD (based on config) try to open the file to create a thumbnail - they fail...
I believe you can load pdf files to CPG as 'application/pdf' and use the Custom Thumbnail plugin to give them a thumbnail...
Does that help with what you are trying to do?
Well, I guess that's how it has to go. I already do use custom thumbnails for SVG files, so all I need to do, is set PDF back to a document.
Are these the right settings for the file type editor? Is this how it should be, to put PDF back to a document:
File extension -- pdf
MIME type -- document/pdf or is it application/pdf?
Content type -- document
player -- ?
Do I need to specify a player for the PDF? Or will it display in the browser?
Thanks again :-)
Take a look at this plugin - http://forum.coppermine-gallery.net/index.php/topic,67970.0.html
Quote from: brynn on January 25, 2015, 05:06:39 AM
Are these the right settings for the file type editor? Is this how it should be, to put PDF back to a document:
File extension -- pdf
MIME type -- document/pdf or is it application/pdf?
Content type -- document
player -- ?
Do I need to specify a player for the PDF? Or will it display in the browser?
Default values:
INSERT INTO CPG_filetypes VALUES ('pdf', 'application/pdf', 'document', '');
Hhm.... After I changed PDF back to a document, it doesn't look like I need to use a custom thumbnail, or the other plugin, that Phill Lockhurst mentioned. It makes a thumbnail, although it does look like it's displaying the thumbnail on the intermediate page. But as long as it displays the full size by clicking on it, that's fine with me.
Anyway, thanks for your help :)