-
-
Couldn't load subscription status.
- Fork 286
Update cookbook-recipe.txt #2121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,6 +28,7 @@ The requirements are the same as for using Kirby's (link: docs/reference/system/ | |
| - ImageMagick must be installed on your server. | ||
| - Calling PHP's `exec()` method must not be disabled. | ||
| - If the ImageMagic convert binary is not correctly linked, you might have to (link: docs/reference/system/options/thumbs#thumbs-driver__additional-options-for-the-imagemagick-driver text: set the path to the `convert` binary) in your config. | ||
| - Gostscript is needed | ||
|
|
||
| ## Setting up the plugin | ||
|
|
||
|
|
@@ -226,20 +227,21 @@ load([ | |
| ], __DIR__); | ||
|
|
||
| Kirby::plugin('cookbook/pdfpreview', [ | ||
| 'hooks' => [ | ||
| 'file.create:after' => function ($file) { | ||
| // only create preview for PDF files | ||
| if ($file->mime() === 'application/pdf') { | ||
| $options = [ | ||
| 'quality' => 100, | ||
| 'page' => 0, | ||
| 'density' => 300, | ||
| ]; | ||
| $darkroom = new PdfPreview(); | ||
| $darkroom->process($file->root(), $options); | ||
| } | ||
| } | ||
| ], | ||
| 'hooks' => [ | ||
| 'file.create:after' => function ($file) { | ||
| // only create preview for PDF files | ||
| if ($file->mime() === 'application/pdf') { | ||
| $options = [ | ||
| 'quality' => 100, | ||
| 'page' => 0, | ||
| 'density' => 300, | ||
| 'colorspace' => false, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I only added options that are different from the defaults, adding the colorspace option here is therefore not necessary. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. are you sure? |
||
| ]; | ||
| $darkroom = new PdfPreview($options); | ||
| $darkroom->process($file->root(), $options); | ||
| } | ||
| } | ||
| ], | ||
| 'fileMethods' => [] | ||
| ]); | ||
| ``` | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.