0

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

Dzo
  • 1
  • 1
  • See here: https://stackoverflow.com/questions/467793/how-do-i-convert-a-pdf-document-to-a-preview-image-in-php – Hillel Mar 22 '21 at 14:17

1 Answers1

0

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

Out of Orbit
  • 543
  • 2
  • 5
  • 17