PDF thumbnail - OctoberCMS

106 Views Asked by At

as I mentioned in title I'm using OctoberCMS and builder plugin in my project and I'm trying to generate thumbnail/preview or to convert pdf file to an image file which I will be able to display in fronted also. Is something like that possible?

Thanks in advance

1

There are 1 best solutions below

0
On

Go to Builder --> Choose plugin / Models / Forms-->fields.yaml Click add control and choose "File upload". Name the field ex. "thumbnail"

You don't need a table column as October automatically handle this for you. You need to add the following to your plugin Model class:

public $attachOne = [
    'thumbnail' => 'System\Models\File',
];

Note that the name "thumbnail" identifier must be the same as your form "field name" See: https://octobercms.com/docs/database/attachments