Skip to content
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

Merged
merged 1 commit into from
Jul 13, 2018

Conversation

tml1024
Copy link
Contributor

@tml1024 tml1024 commented Jul 11, 2018

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.

@MorrisJobke
Copy link
Member

$pdf = new \imagick($pdfPreview . '[0]');
$pdf->setImageFormat('jpg');
$png = new \imagick($pngPreview . '[0]');
$png->setImageFormat('jpg');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

? why convert to jpg?

Copy link
Contributor Author

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.

Copy link
Member

@rullzer rullzer left a 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 👍

@rullzer
Copy link
Member

rullzer commented Jul 12, 2018

@tml1024 thnx!

Could you sign off your commit

git commit --amend -s
git push -f

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]>
@MorrisJobke MorrisJobke added this to the Nextcloud 14 milestone Jul 13, 2018
@MorrisJobke MorrisJobke merged commit 7a5768e into nextcloud:master Jul 13, 2018
MorrisJobke added a commit that referenced this pull request Jul 13, 2018
Signed-off-by: Morris Jobke <[email protected]>
kesselb added a commit that referenced this pull request Nov 13, 2023
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]>
kesselb added a commit that referenced this pull request Nov 13, 2023
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]>
zak39 pushed a commit to zak39/server that referenced this pull request Dec 19, 2023
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants