-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Images not rendered correctly on LibreOffice #667
Comments
@xprt64 Which version of LibreOffice are you using? Can you upload a sample doc? I may have ran into this bug before. |
Version: 4.3.3.2 The code I posted on is about an old version of PhpWord but the bug is 2015-11-27 15:28 GMT+02:00 michael chrisco [email protected]:
Best regards, |
Ill take a look on my side when I get a chance. If memory serves, the issue has something to do with the GD extension. http://php.net/manual/en/book.image.php The offender might have something to do with the image element: https://github.com/PHPOffice/PHPWord/blob/develop/src/PhpWord/Element/Image.php I know I was testing on MS Word and the stretching was happening. |
It's not about GD, the image is fine in the docx file and the dimensions 2015-11-27 15:48 GMT+02:00 michael chrisco [email protected]:
Best regards, |
Blurry for me too, even in MS Word. |
I found out this is only on images from remote URLs, rather than a local path. I've changed my code from:
To:
Not a great solution, but it works for now! FYI, rendering of the image looked fine (before this solution) on any file type other than Word2007. |
Huh that's a strange one....any indication why a remote URL would stretch On Wed, Apr 6, 2016 at 2:48 PM, Sam Sullivan [email protected]
|
It's in quite a big tech stack using private AWS images to create custom reports, so I made an example for you using Google's logo. Something crazier than just bad quality happened... Here's the sample code:
Also, I noticed that JPGs were much better quality -- if not perfect. You can see if you use the above example with this image. So, my bug (not sure if it's related to OP, honestly...let me know if I should open a new ticket), is narrowed to Word2007/PNG/remote. |
I've figured out why this bug exists (and it does take place in
It looks like PHPWord doesn't use We need to find a way to work this into |
Sounds good to me. On Thu, Apr 7, 2016 at 4:57 PM, Sam Sullivan [email protected]
|
I've opened a PR for this, Michael. Didn't test it with the HTML writer (which seems to use a different method), but everything looks good and it does fix the Word2007 issue. |
The images are not rendered correctly (at least on LibreOffice), they get enlarged by a few millimeters and thus get fuzzy. I resolved the issue by modifying the width and height attributes from pixels to points in
PHPWord_Writer_Word2007_Base::_writeImage()
like this:Environment: Linux version 3.16.0-4-amd64 ([email protected]) (gcc version 4.8.4 (Debian 4.8.4-1) ) #1 SMP Debian 3.16.7-ckt11-1+deb8u6 (2015-11-09)
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: