M
M
Maxim Grechushnikov2014-11-18 12:55:19
1C-Bitrix
Maxim Grechushnikov, 2014-11-18 12:55:19

Bitrix: What am I doing wrong with CFile::ResizeImageGet?

Recently, previews have disappeared. I can't figure out why.
Images are loaded via api from outside.
At random came to this line:

CFile::ResizeImageGet($array["DETAIL_PICTURE"], array('width'=>100, 'height'=>100), BX_RESIZE_IMAGE_PROPORTIONAL, true);

This method must return an array with a reference to the image and its dimensions. but it doesn't return anything.
100% of the array contains CFile::MakeFileArray(...)
the file exists and has read and even write access. I also checked access to apploads.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Grechushnikov, 2014-11-18
@maxyc_webber

in short, Bitrix API offers

<?if($arResult["DETAIL_PICTURE"]) {
   $PICTURE = CFile::ResizeImageGet($arResult["DETAIL_PICTURE"], Array('width'=>340, 'height'=>340), BX_RESIZE_IMAGE_PROPORTIONAL, true);?>
   <div class="Image"><img src="<?=$PICTURE["src"]?>" alt="<?=$arResult["NAME"]?>" title="<?=$arResult["NAME"]?>" /></div>
<?}?>

but at the input of this method is
if (!is_array($file) || !array_key_exists("FILE_NAME", $file) || strlen($file["FILE_NAME"]) <= 0)
      return false;

I have no idea where these idiots found such keys in $file
even the same MakeFileArray returns other keys
$arFile["name"] = $io->GetLogicalName(bx_basename($path));
      $arFile["size"] = filesize($path);
      $arFile["tmp_name"] = $path;
      $arFile["type"] = $mimetype;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question