Jump to:

23372 Posts in 18175 Topics by 2865 members

General Questions

SilverStripe Forums » General Questions » Extract a thumbnail from PDF files

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 426 Views
  • sajok
    Avatar
    Community Member
    82 Posts

    Extract a thumbnail from PDF files Link to this post

    Hello,

    I have a downloads page with only pdf files, and the client wants to see thumbnails of the files in addition to download links. I'd like to know if it's possible to extract a thumbnail from the first page of a pdf file. I tried something like this but it returns the pdf icon link:

    class Resource extends DataObject {

    public static $db = array(
    'Title'=>'Varchar(255)'
    );

    public static $has_one = array(
    'PDF' => 'File',
    'ResourcesPage' => 'ResourcesPage'
    );

    // Summary fields
    public static $summary_fields = array(
    'Thumbnail' => 'Thumbnail',
    'Title' => 'Title'
    );

    public function getThumbnail() {
    return $this->PDF()->CMSThumbnail();
    }

    any idea if I'm missing something here or anyway to accomplish this?

    thanks

  • mierla
    Avatar
    Community Member
    16 Posts

    Re: Extract a thumbnail from PDF files Link to this post

    sajok, I'm running up against the same issue - did you ever figure this out?

  • tazzydemon
    Avatar
    Community Member
    120 Posts

    Re: Extract a thumbnail from PDF files Link to this post

    I posted about this one a while back. You will have to have ImageMagick installed but it also requires a change to the way the filesystem handles PDFs. I have not managed to kludge it yet.

    426 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.