Answer the question
In order to leave comments, you need to log in
How to resize an image in Bitrix?
I create a completely new property CONSULTANT_FOTO how to display and resize it?
It turned out to withdraw, but resize is no longer possible.
<? $file_path = CFile::GetPath($arResult['DISPLAY_PROPERTIES']['CONSULTANT_FOTO']['VALUE']); ?>
<img src="<?= $file_path ?>" width="247px" height="auto"/>
Answer the question
In order to leave comments, you need to log in
If you resize on the fly and cache the reduced image (it returns it again from the cache), then try using the CFile::ResizeImageGet
class.
Theoretically, this code should work like this (if CONSULNANT_FOTO is a property of the "file" type, not a string) :
<?
$wsize = 100; // новая ширина 100 пикселей
$hsize = 100; // новая высота 100 пикселей
$file_path = CFile::ResizeImageGet(
$arResult['DISPLAY_PROPERTIES']['CONSULTANT_FOTO']['VALUE'], // ID файла
Array("width" => $wsize, "height" => $hsize),
BX_RESIZE_IMAGE_EXACT, // тип масштабирования, подробнее в документации по ссылке выше
false);
?>
<img src="<?=$file_path['src']?>" width="<?=$wsize?>" height="auto"/>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question