Forum


Replies: 3   Views: 2853
How do i scale an image to a given height?
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by Vlad123  · 07-08-2017 - 15:04

Is there a way to scale images to a given height value without breaking the aspect ratio while adding them with addImage() or otherwise? Something like saying

$image->addImage([
    'src' => 'path/to/image.png',
    'height' => 500,
    'width' => 'auto'
]);

So that all the different images i'm adding would have same height and different width in correspondace with the aspect ratio.

Thank you in advance for your answer.