Chose which page to be the thumbnail preview from PDF files

Hello everyone!

Well, the question is quite straighforward and obvious. I have a collection composed of PDF files, and many of them are anciente scanned books, most of them the first page is the book cover, and since they are quite old, most of the covers ar just a green / red cover with no information.

After a few pages, is the page with the catalographic info of the book, which would be perfect to be on the thumbnail for the archive.

Question is, is there a way to customize which page will be the preview, instead of being always the first page? Maybe with a custom field with a number which will be the thumbnail page?

even if I have to hardcode it on omeka itself, any tips on where the page thumb is collected will be appreciated.

it looks pretty obvious to me, hope this possibility comes with newer omeka versions.

This is a case of trying to reconcile a general solution that fits all cases with the particular needs of a particular set of cases. To reliably get _some_ derivative in any case of the file, we grab the derivative based on the first page. For a PDF, that's the first page, and for a video, that's the first frame.

That gets something in all cases. Customizing the derivative generated is pretty hard to be useful -- when uploading a file, it's hard to know which frame or page should be the actual derivative image in each case beforehand.

That said, if you know that the real page you want is consistently, for example, the 3rd page, you could try using Derivative Images to convert all the pdfs, and hack the core file (which I rarely reccomend) application/libraries/Omeka/File/Derivative/Image/Creator.php , line 163 to change

escapeshellarg($origPath . '[0]'


escapeshellarg($origPath . '[2]'

for the third page.

After the conversion with Derivative Images, you'd want to change it back to avoid oddities with other file types.

Should say, too, that I have not tested this yet, but it seems like the general approach to try.

If the page you want is not consistent, this approach won't really work. And, keep in mind, this approach will affect all the pdf files when you select pdfs from the Derivative Images settings.

So as you can see there are actually a lot of variables to handle, and so this seems more likely something to be handled by a precisely-targeted plugin than a feature of core Omeka.

well, thats the case. I have to implement this as the users could easly post new pdf documents, and only choose into another field which page would be the previewed one.

is there a way to handle an outside variable on this line on image derivative?

As it stands, there's not really a good way in Omeka core to do this. As a plugin, it might be possible to model something off of Derivative Images, but for single files instead of a bulk operation