Skip to content

Fix incorrect image size between windows and mac. #874

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

Merged
merged 1 commit into from
Nov 7, 2017
Merged

Fix incorrect image size between windows and mac. #874

merged 1 commit into from
Nov 7, 2017

Conversation

hskrtich
Copy link
Contributor

See Issue #224

@jorisvm
Copy link

jorisvm commented Aug 31, 2016

I had a simular problem in a project today and ended up converting the pixels to points. What I did was add the folowing lines to: Writer/Word2007/Element/Image.php in the writeImage method:

<?php

// Force styles in points (Google drive and word for MAC don't like pixels for images)
        $style->setUnit('pt');
        $style->setWidth(number_format(\PhpOffice\PhpWord\Shared\Converter::pixelToPoint($style->getWidth()), 2, '.', ''));
        $style->setHeight(number_format(\PhpOffice\PhpWord\Shared\Converter::pixelToPoint($style->getHeight()), 2, '.', ''));
?>

@troosan troosan added this to the v0.14.0 milestone Nov 7, 2017
@troosan troosan merged commit 13dc3bb into PHPOffice:develop Nov 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants