PDF as image? PDF as image?
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

PDF as image?

Started by brynn, January 23, 2015, 03:10:57 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

brynn

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   :)

brynn

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!"

Αndré

What exactly do you want to achieve? PDF files are no images: http://en.wikipedia.org/wiki/Portable_Document_Format

brynn

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....

gmc

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
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?



Thanks!
Greg
My Coppermine Gallery
Need a web hosting account? See my gallery for an offer for CPG Forum users.
Send me money

brynn

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  :-)

phill104

It is a mistake to think you can solve any major problems just with potatoes.

Αndré

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:
Code (sql/basic.sql) Select
INSERT INTO CPG_filetypes VALUES ('pdf', 'application/pdf', 'document', '');

brynn

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  :)