J
J
jorshjorsh952018-07-29 10:55:43
1C-Bitrix
jorshjorsh95, 2018-07-29 10:55:43

Resizing images in Bitrix by exact dimensions?

Good afternoon, I'm using CFile::ResizeImageGet with BX_RESIZE_IMAGE_EXACT, but the whole problem is that it crops a non-perfect pixel as specified in width/height:

$resize = CFile::ResizeImageGet($photo, array("width" => 875, "height" => 530), BX_RESIZE_IMAGE_EXACT, true);

BUT it still does not work as it should, returns +- 1-2px in height, because of this the layout dances a little ..
How to overcome all this?
UPD. I tried it in conjunction with CFile::ShowImage:
CFile::ShowImage($resize['src'], 875, 530, "", "", true);

Still brought me a picture - 550 x 344, instead of my 875x530

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor Petrov, 2018-07-30
@tamerline

Try this:
<?
$renderImage = "";
$renderImage = CFile::ResizeImageGet( $arItem["PREVIEW_PICTURE"]["ID"], Array("width" => 875, "height" => 530), BX_RESIZE_IMAGE_EXACT, true);
?>
<img src = " <?=$renderImage["src"] ? > " >

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question