M
M
Maxim Volkov2019-09-24 17:03:07
1C-Bitrix
Maxim Volkov, 2019-09-24 17:03:07

CFile::ResizeImageGet — Is it possible to resize images only in width with changing height based on aspect ratio?

You need to resize images for previews, but the original images have different heights.
Bitrix method CFile::ResizeImageGet - to resize images on the fly, you need to set the required height and width parameters. It is necessary to resize, only in width, while the height changes depending on the aspect ratio.
Is there any way to make images resize only in width, with height based change and aspect ratio?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2019-09-24
@voland700

It is possible to calculate the parameters in advance, but in practice, you can use BX_RESIZE_IMAGE_PROPORTIONAL and set the height to a known value.
For example Array("width"=>100, "height"=>10000) will work for all images whose ratio is not greater than 1 to 100

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question