-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
No need to convert to PDF with LibreOffice, just convert to PNG #10198
Conversation
$pdf = new \imagick($pdfPreview . '[0]'); | ||
$pdf->setImageFormat('jpg'); | ||
$png = new \imagick($pngPreview . '[0]'); | ||
$png->setImageFormat('jpg'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
? why convert to jpg?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't ask me, that is what the code did originally, too. First it had LibreOffice export to PDF, then converted that to JPG. I just changed that so that it has LibreOffice export to PNG first.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with this for now 👍
@tml1024 thnx! Could you sign off your commit
that should do the trick :) |
Exporting all pages of a document to a PDF is a waste of time. All we need is a thumbnail of the first page anyway. Plus, reading that PDF (even just the first page of it) into imagick is presumably much slower than reading a simple PNG. Signed-off-by: Tor Lillqvist <[email protected]>
Signed-off-by: Morris Jobke <[email protected]>
The initial office preview implementation converted an office document with LibreOffice to PDF, used ImageMagick to extract the first page as JPEG, and passed it OC_Image. #10198 changed the implementation to use PNG rather than PDF. OC_Image can use a PNG as a preview right away, so the ImageMagick step is unnecessary. The registration code was updated to not ask ImageMagick if PDF is supported, as PDFs are no longer used to create office document previews. Signed-off-by: Daniel Kesselberg <[email protected]>
The initial office preview implementation converted an office document with LibreOffice to PDF, used ImageMagick to extract the first page as JPEG, and passed it OC_Image. #10198 changed the implementation to use PNG rather than PDF. OC_Image can use a PNG as a preview right away, so the ImageMagick step is unnecessary. The registration code was updated to not ask ImageMagick if PDF is supported, as PDFs are no longer used to create office document previews. Signed-off-by: Daniel Kesselberg <[email protected]>
The initial office preview implementation converted an office document with LibreOffice to PDF, used ImageMagick to extract the first page as JPEG, and passed it OC_Image. nextcloud#10198 changed the implementation to use PNG rather than PDF. OC_Image can use a PNG as a preview right away, so the ImageMagick step is unnecessary. The registration code was updated to not ask ImageMagick if PDF is supported, as PDFs are no longer used to create office document previews. Signed-off-by: Daniel Kesselberg <[email protected]>
Exporting all pages of a document to a PDF is a waste of time. All we
need is a thumbnail of the first page anyway. Plus, reading that PDF
(even just the first page of it) into imagick is presumably much
slower than reading a simple PNG.