P
P
Pavel Sidorov2020-09-04 17:21:05
1C-Bitrix
Pavel Sidorov, 2020-09-04 17:21:05

Is there a resize photo in Bitrix api for height and width?

Good afternoon
Tell me if there is an api for Bitrix resize a photo for width and height while maintaining proportions.

let's say people load 1170x700, then resize according to my parameters 720x520 while maintaining proportions.

The only important nuance is that my proportions must be forcibly built 720x520 and not less than the height.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
PetrPo, 2020-09-04
@pavel__sidorov

First option
Do CFile::ResizeImageGet BX_RESIZE_IMAGE_PROPORTIONAL_ALT and set the width to large, like 10000, and the height = 520, then the height limit of 520 will always apply

$imageId = 1;

$arImage = CFile::ResizeImageGet($imageId, array("width" => 10000, "height" => 520), BX_RESIZE_IMAGE_PROPORTIONAL_ALT, false);

the second option
I can offer is css
.owl-item>div>div>a{
    position: relative;
    padding-top: 80%;
    display: block;}

.owl-item>div>div>a>img{
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    object-fit: cover}

only from a sign > get rid then, a class any on the link hang up. And with this padding-top: 80% you can play - less / more to do

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question