A
A
Alexander Ivanov2016-03-03 13:40:06
1C-Bitrix
Alexander Ivanov, 2016-03-03 13:40:06

How to change the image size in bitrisk news?

How I try to do this and it doesn't work:

<? 
      $renderImage = CFile::ResizeImageGet($arItem["PREVIEW_PICTURE"], Array("width" => 200, "height" => 100), BX_RESIZE_IMAGE_EXACT, false); 
      echo '<img alt="'.$arItem["NAME"].'" src="'.$renderImage["src"].'" />'; 
?>

What's wrong?
Already seen:
dev.1c-bitrix.ru/support/forum/forum6/topic45008
camouf.ru/blog-note/833
camouf.ru/blog-note/421
forwww.com/how-to-get-path-to- image-in-1c-bitrix
connoisseurs lose again...
What I recently realized:
In my case, the problem is not just a reduction. but in magnification.
I'd rather turn off the autoresizing function altogether, tk. 200 for news and 400 for detailed is not enough!
PS The saddest thing is that these underdeveloped developers did not even think of changing these parameters in the interface. Of course, I'll say sorry if I'm wrong, but I'm very glad that I didn't spend money on this system.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexander Ivanov, 2016-03-03
@cimonlebedev

The answer was in the interface:
888a02b76f364e22b95e9125830bbc5e.jpg

R
Rad1calDreamer, 2016-03-04
@Rad1calDreamer

almost all CFile methods work with a file ID. Give it to him and you will be happy
this is the array that the component returned to you.
Reading the documentation
And we understand that the component can return something completely different from what the СFile class wants.
UPD
from the links provided
Enlarging the image in ANY way will result in a loss of quality. If you need to enlarge the picture, find it with dimensions larger than necessary and reduce it to the required size.

E
Express777, 2016-03-04
@Express777

If you are using a component and your code is in a template
Try this:

<?
$renderImage = CFile::ResizeImageGet($arItem["PREVIEW_PICTURE"]['ID'], Array("width" => 200, "height" => 100), BX_RESIZE_IMAGE_EXACT, false);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question