/** Returns an array, containing information about the product block on its ID. * @param $elementId * @return array|string */ public static function getProductInfo($elementId) { $elementId = intval($elementId); $result = ""; if ($elementId <= 0) { return $result; } $dbProduct = CIBlockElement::GetList(array(), array("ID" => $elementId), false, false, array('ID', 'IBLOCK_ID', 'IBLOCK_SECTION_ID', 'DETAIL_PICTURE', 'PREVIEW_PICTURE', 'NAME', 'XML_ID')); while ($arProduct = $dbProduct->GetNext()) { $imgCode = ""; if ($arProduct["IBLOCK_ID"] > 0) { $arProduct["EDIT_PAGE_URL"] = CIBlock::GetAdminElementEditLink($arProduct["IBLOCK_ID"], $elementId, array("find_section_section" => $arProduct["IBLOCK_SECTION_ID"])); } if ($arProduct["DETAIL_PICTURE"] > 0) { $imgCode = $arProduct["DETAIL_PICTURE"]; } elseif ($arProduct["PREVIEW_PICTURE"] > 0) { $imgCode = $arProduct["PREVIEW_PICTURE"]; } $arProduct["NAME"] = $arProduct["NAME"]; $arProduct["DETAIL_PAGE_URL"] = htmlspecialcharsex($arProduct["DETAIL_PAGE_URL"]); if ($imgCode > 0) { $arFile = CFile::GetFileArray($imgCode); $arImgProduct = CFile::ResizeImageGet($arFile, array('width' => 80, 'height' => 80), BX_RESIZE_IMAGE_PROPORTIONAL, false, false); $arProduct["IMG_URL"] = $arImgProduct['src']; } return $arProduct; } return $result; }
function GetResizedImage($id, $width, $height) { $arSize = array("width" => $width, "height" => $height); $file = CFile::GetFileArray($id); $resized = CFile::ResizeImageGet($file, $arSize); return $resized; }
function __mpl_get_avatar() { global $USER; static $avatar = null; if ($avatar == null) { $avatar = '/bitrix/images/1.gif'; if ($USER->IsAuthorized()) { $u = CUser::GetByID($USER->GetID())->Fetch(); if ($u["PERSONAL_PHOTO"]) { $res = CFile::ResizeImageGet( $u["PERSONAL_PHOTO"], array('width' => 58, 'height' => 58), BX_RESIZE_IMAGE_EXACT, false ); if ($res["src"]) $avatar = $res["src"]; } } } return $avatar; }
function __main_post_form_image_resize(&$arCustomFile, $arParams = null) { static $arResizeParams = array(); if ($arParams !== null) { if (is_array($arParams) && array_key_exists("width", $arParams) && array_key_exists("height", $arParams)) { $arResizeParams = $arParams; } elseif (intVal($arParams) > 0) { $arResizeParams = array("width" => intVal($arParams), "height" => intVal($arParams)); } } if (!is_array($arCustomFile) || !isset($arCustomFile['fileID'])) { return false; } if (array_key_exists("ID", $arCustomFile)) { $arFile = $arCustomFile; $fileID = $arCustomFile['ID']; } else { $fileID = $arCustomFile['fileID']; $arFile = CFile::MakeFileArray($fileID); $arFile1 = CFile::GetByID($fileID)->fetch(); if (is_array($arFile) && is_array($arFile1)) { $arCustomFile = array_merge($arFile, $arFile1, $arCustomFile); } } if (CFile::CheckImageFile($arFile) === null) { $aImgThumb = CFile::ResizeImageGet($fileID, array("width" => 90, "height" => 90), BX_RESIZE_IMAGE_EXACT, true); $arCustomFile['img_thumb_src'] = $aImgThumb['src']; if (!empty($arResizeParams)) { $aImgSource = CFile::ResizeImageGet($fileID, array("width" => $arResizeParams["width"], "height" => $arResizeParams["height"]), BX_RESIZE_IMAGE_PROPORTIONAL, true); $arCustomFile['img_source_src'] = $aImgSource['src']; $arCustomFile['img_source_width'] = $aImgSource['width']; $arCustomFile['img_source_height'] = $aImgSource['height']; } } }
function __MPF_ImageResizeHandler(&$arCustomFile, $arParams = null) { static $arResizeParams = array(); if ($arParams !== null) { if (is_array($arParams) && array_key_exists("width", $arParams) && array_key_exists("height", $arParams)) { $arResizeParams = $arParams; } elseif (intVal($arParams) > 0) { $arResizeParams = array("width" => intVal($arParams), "height" => intVal($arParams)); } } if (!is_array($arCustomFile) || !isset($arCustomFile['fileID'])) { return false; } $fileID = $arCustomFile['fileID']; $arFile = CFile::MakeFileArray($fileID); if (CFile::CheckImageFile($arFile) === null) { $aImgThumb = CFile::ResizeImageGet($fileID, array("width" => 90, "height" => 90), BX_RESIZE_IMAGE_EXACT, true); $arCustomFile['img_thumb_src'] = $aImgThumb['src']; if (!empty($arResizeParams)) { $aImgSource = CFile::ResizeImageGet($fileID, array("width" => $arResizeParams["width"], "height" => $arResizeParams["height"]), BX_RESIZE_IMAGE_PROPORTIONAL, true); $arCustomFile['img_source_src'] = $aImgSource['src']; $arCustomFile['img_source_width'] = $aImgSource['width']; $arCustomFile['img_source_height'] = $aImgSource['height']; } } }
/** * ’эндлер, отслеживающий изменени¤ в инфоблоках * @param $arFields * @return bool */ static function getCradoBaners() { //$arResult = array(); CModule::IncludeModule('iblock'); global $DB; $result = $DB->Query('SELECT * FROM b_cradobaners'); $arResult = array(); $i = 0; while ($res = $result->fetch()) { $arResult[$i]['ID'] = $res['ID']; $arResult[$i]['COUNT_CLICK'] = $res['UF_COUNTCLICK']; $arResult[$i]['COUNT_VIEW'] = $res['UF_COUNTVIEW']; $arResult[$i]['DATE_LAST_CLICK'] = $res['UF_DATECLICK']; $obElement = CIBlockElement::GetByID($res['UF_IDBANERS']); if ($arEl = $obElement->GetNext()) { //$arResult[$i]['BANNER'] = $arEl; $arResult[$i]['BANNER']['ID'] = $arEl['ID']; $arResult[$i]['BANNER']['NAME'] = $arEl['NAME']; //Баннер в категории if ($arEl['PREVIEW_PICTURE'] != '') { $arResult[$i]['BANNER']['BANNER_CATEGORY'] = CFile::ResizeImageGet($arEl['PREVIEW_PICTURE'], array('width' => 140, 'height' => 95), BX_RESIZE_IMAGE_PROPORTIONAL, true); } if ($arEl['DETAIL_PICTURE'] != '') { $arResult[$i]['BANNER']['BANNER_ELEMENT'] = CFile::ResizeImageGet($arEl['DETAIL_PICTURE'], array('width' => 82, 'height' => 140), BX_RESIZE_IMAGE_PROPORTIONAL, true); } } $i++; } return $arResult; }
function getProductInfo($arData) { $result = ""; if (!is_array($arData) || count($arData) <= 0) { return $result; } $dbProduct = CIBlockElement::GetList(array(), array("ID" => $arData["ELEMENT_ID"]), false, false, array('ID', 'IBLOCK_ID', 'IBLOCK_SECTION_ID', 'DETAIL_PICTURE', 'PREVIEW_PICTURE', 'IBLOCK_TYPE_ID', 'NAME')); while ($arProduct = $dbProduct->GetNext()) { $imgCode = ""; if ($arProduct["IBLOCK_ID"] > 0) { $arProduct["EDIT_PAGE_URL"] = "/bitrix/admin/iblock_element_edit.php?ID=" . $arProduct["ID"] . "&type=" . $arProduct["IBLOCK_TYPE_ID"] . "&lang=" . LANG . "&IBLOCK_ID=" . $arProduct["IBLOCK_ID"] . "&find_section_section=" . intval($arProduct["IBLOCK_SECTION_ID"]); } if ($arProduct["DETAIL_PICTURE"] > 0) { $imgCode = $arProduct["DETAIL_PICTURE"]; } elseif ($arProduct["PREVIEW_PICTURE"] > 0) { $imgCode = $arProduct["PREVIEW_PICTURE"]; } $arProduct["NAME"] = htmlspecialcharsex($arProduct["NAME"]); $arProduct["DETAIL_PAGE_URL"] = htmlspecialcharsex($arProduct["DETAIL_PAGE_URL"]); $arProduct["CURRENCY"] = htmlspecialcharsex($arProduct["CURRENCY"]); if ($imgCode > 0) { $arFile = CFile::GetFileArray($imgCode); $arImgProduct = CFile::ResizeImageGet($arFile, array('width' => 80, 'height' => 80), BX_RESIZE_IMAGE_PROPORTIONAL, false, false); $arProduct["IMG_URL"] = $arImgProduct['src']; } return $arProduct; } }
private function getImageByID($id, $resizeFor) { $size['width'] = intval($this->getSettings($resizeFor . '_WIDTH')); $size['height'] = intval($this->getSettings($resizeFor . '_HEIGHT')); $filters = $this->getSettings($resizeFor . '_FILTERS'); $quality = $this->getSettings($resizeFor . '_QUALITY'); return \CFile::ResizeImageGet($id, $size, BX_RESIZE_IMAGE_EXACT, true, $filters, false, $quality); }
public static function getUserPhotoSrc(array $user) { if (empty($user['PERSONAL_PHOTO'])) { return ''; } $arFileTmp = \CFile::ResizeImageGet($user["PERSONAL_PHOTO"], array('width' => 58, 'height' => 58), \BX_RESIZE_IMAGE_EXACT, false); return $arFileTmp['src']; }
/** * Ресурс файла * @param string $field Название поля для ресурса * @param mixed $resized Если необходим ресайзер * @return string Ресурс */ public function src($field, $resized = false) { if (false === $resized) { $src['src'] = CFile::GetPath($this->item[$field]); } else { $src = CFile::ResizeImageGet($this->item[$field], array("width" => $resized[0], "height" => $resized[1]), BX_RESIZE_IMAGE_EXACT, false); } return $src; }
protected function getStartedByPhoto($userId) { $iterator = \CUser::GetList($by = 'id', $order = 'asc', array('ID' => $userId), array('FIELDS' => array('PERSONAL_PHOTO'))); $startedUser = $iterator->fetch(); if ($startedUser) { return \CFile::ResizeImageGet($startedUser['PERSONAL_PHOTO'], array('width' => 58, 'height' => 58), \BX_RESIZE_IMAGE_EXACT, false); } return null; }
/** * [waterImage description] * @param int $imgId * @return array */ function waterImage($imgId) { $arFile = CFile::GetFileArray($imgId); $arFilters = array(array("name" => "watermark", "position" => "bottomleft", "size" => "real", "alpha_level" => "50", "file" => $_SERVER['DOCUMENT_ROOT'] . "/img/watermark.png")); $width = $arFile["WIDTH"]; $height = $arFile["HEIGHT"]; $resultImage = CFile::ResizeImageGet($arFile, array('width' => $width, 'height' => $height), BX_RESIZE_IMAGE_PROPORTIONAL, true, $arFilters); return $resultImage; }
function resize($img, $PROP, $width, $height) { if ($PROP == 'Y') { $file = CFile::ResizeImageGet($img, array('width' => $width, 'height' => $height), BX_RESIZE_IMAGE_PROPORTIONAL, true, false, false, 100); } else { $file = CFile::ResizeImageGet($img, array('width' => $width, 'height' => $height), BX_RESIZE_IMAGE_EXACT, true, false, false, 100); } $result = array('ID' => $img, 'SRC' => $file['src'], 'WIDTH' => $file['width'], 'HEIGHT' => $file['height']); return $result; }
function socialnetworkBlogPostCommentMobile(array $comment, array $arParams, array $arResult, SocialnetworkBlogPostComment $component) { global $APPLICATION; $arParams["AVATAR_SIZE"] = intval($arParams["AVATAR_SIZE"]) ?: 58; $arAvatarSizes = array("AVATAR_SIZE" => intval(array_key_exists("AVATAR_SIZE_COMMON", $arParams) ? $arParams["AVATAR_SIZE_COMMON"] : $arParams["AVATAR_SIZE"]), "AVATAR_SIZE_COMMENT" => intval($arParams["AVATAR_SIZE_COMMENT"])); $arAvatarSizes["AVATAR_SIZE"] = $arAvatarSizes["AVATAR_SIZE"] > 0 ? $arAvatarSizes["AVATAR_SIZE"] : 42; // reference to CBlogUser::GetUserInfoArray $arAvatarSizes["AVATAR_SIZE_COMMENT"] = $arAvatarSizes["AVATAR_SIZE_COMMENT"] > 0 ? $arAvatarSizes["AVATAR_SIZE_COMMENT"] : 42; // reference to CBlogUser::GetUserInfoArray $avatarKey = "PERSONAL_PHOTO_RESIZED"; if ($arAvatarSizes["AVATAR_SIZE"] == $arParams["AVATAR_SIZE"]) { $avatarKey = "PERSONAL_PHOTO_resized"; } else { if ($arAvatarSizes["AVATAR_SIZE_COMMENT"] == $arParams["AVATAR_SIZE"]) { $avatarKey = "PERSONAL_PHOTO_resized_30"; } } $arUser = $arResult["userCache"][$comment["AUTHOR_ID"]]; if (!array_key_exists($avatarKey, $arUser) && intval($arUser["PERSONAL_PHOTO"]) > 0) { $arResult["userCache"][$comment["AUTHOR_ID"]][$avatarKey] = CFile::ResizeImageGet($arUser["PERSONAL_PHOTO"], array("width" => $arParams["AVATAR_SIZE"], "height" => $arParams["AVATAR_SIZE"]), BX_RESIZE_IMAGE_EXACT); $arUser = $arResult["userCache"][$comment["AUTHOR_ID"]]; } $text = $comment["TextFormated"]; if ($component->isWeb()) { static $parser = null; if ($parser == null) { $parser = new blogTextParser(false, $arParams["PATH_TO_SMILE"]); $parser->bMobile = true; $parser->LAZYLOAD = isset($arParams["LAZYLOAD"]) && $arParams["LAZYLOAD"] == "Y" ? "Y" : "N"; } if (is_array($comment["COMMENT_PROPERTIES"]["DATA"]["UF_BLOG_COMMENT_FILE"])) { $parser->arUserfields = array("UF_BLOG_COMMENT_FILE" => array_merge($comment["COMMENT_PROPERTIES"]["DATA"]["UF_BLOG_COMMENT_FILE"], array("TAG" => "DOCUMENT ID"))); } $text = $parser->convert($comment["POST_TEXT"], false, $comment["showedImages"], array("HTML" => "N", "ANCHOR" => "Y", "BIU" => "Y", "IMG" => "Y", "QUOTE" => "Y", "CODE" => "Y", "FONT" => "Y", "LIST" => "Y", "SMILES" => "Y", "NL2BR" => "N", "VIDEO" => COption::GetOptionString("blog", "allow_video", "Y") != "Y" || $arParams["ALLOW_VIDEO"] != "Y" ? "N" : "Y", "SHORT_ANCHOR" => "Y"), array("pathToUser" => "/mobile/users/?user_id=#user_id#")); } $res = array("ID" => $comment["ID"], "NEW" => $arParams["FOLLOW"] != "N" && $comment["NEW"] == "Y" ? "Y" : "N", "APPROVED" => $comment["PUBLISH_STATUS"] == BLOG_PUBLISH_STATUS_PUBLISH ? "Y" : "N", "POST_TIMESTAMP" => !empty($comment["DATE_CREATE_TS"]) ? $comment["DATE_CREATE_TS"] + $arResult["TZ_OFFSET"] : MakeTimeStamp($comment["DATE_CREATE"]) - $arResult["TZ_OFFSET"], "AUTHOR" => array("ID" => $arUser["ID"], "NAME" => $arUser["~NAME"], "LAST_NAME" => $arUser["~LAST_NAME"], "SECOND_NAME" => $arUser["~SECOND_NAME"], "AVATAR" => array_key_exists($avatarKey, $arUser) ? $arUser[$avatarKey]["src"] : ''), "FILES" => false, "UF" => false, "POST_MESSAGE_TEXT" => $text, "~POST_MESSAGE_TEXT" => $comment["POST_TEXT"], "CLASSNAME" => "", "BEFORE_HEADER" => "", "BEFORE_ACTIONS" => "", "AFTER_ACTIONS" => "", "AFTER_HEADER" => "", "BEFORE" => "", "AFTER" => "", "BEFORE_RECORD" => "", "AFTER_RECORD" => ""); if (!empty($arResult["arImages"][$comment["ID"]])) { $res["FILES"] = array(); foreach ($arResult["arImages"][$comment["ID"]] as $i => $val) { $t = $arResult["Images"][$i]; $res["FILES"][] = array("THUMBNAIL" => $val["small"], "SRC" => $val["full"], "FILE_SIZE" => $t["source"]["size"], "CONTENT_TYPE" => "image/xyz", "ORIGINAL_NAME" => $t["fileName"], "FILE_NAME" => $t["fileName"]); } } if ($comment["COMMENT_PROPERTIES"]["SHOW"] == "Y") { $res["UF"] = $comment["COMMENT_PROPERTIES"]["DATA"]; foreach ($res["UF"] as $key => $arPostField) { if (!empty($arPostField["VALUE"])) { $res["UF"][$key]['POST_ID'] = $arParams['POST_DATA']['ID']; $res["UF"][$key]['URL_TO_POST'] = str_replace('#source_post_id#', $arPostField['POST_ID'], $arResult['urlToPost']); } } } return $res; }
/** * Возвращает массив с данными о картинке, пережатой до нужных размеров * @return array */ public function getResized($width, $height, $type = null, $bInitSizes = false, array $arFilters = null, $bImmediate = false, $jpgQuality = false, $bFullArray = false) { $return = null; $type = $type === null ? BX_RESIZE_IMAGE_PROPORTIONAL : $type; $fileArray = $this->getFileArray(); if ($fileArray) { $return = \CFile::ResizeImageGet($fileArray, array('width' => $width, 'height' => $height), $type, $bInitSizes, $arFilters, $bImmediate, $jpgQuality); } /* fix when we needed full file array, fix at 07.10.2016 */ return !empty($return['src']) ? $bFullArray ? $return : $return['src'] : null; }
function group2JSItem($arGroup, $fieldPrevix = "") { $arGroupTmp = array("ID" => $arGroup[$fieldPrevix . "ID"], "id" => $arGroup[$fieldPrevix . "ID"], "title" => $arGroup[$fieldPrevix . "NAME"], "description" => $arGroup[$fieldPrevix . "DESCRIPTION"]); if ($arGroup[$fieldPrevix . "IMAGE_ID"]) { $imageFile = CFile::GetFileArray($arGroup[$fieldPrevix . "IMAGE_ID"]); if ($imageFile !== false) { $arFileTmp = CFile::ResizeImageGet($imageFile, array("width" => 30, "height" => 30), BX_RESIZE_IMAGE_PROPORTIONAL, false); $arGroupTmp["image"] = $arFileTmp["src"]; } } return $arGroupTmp; }
function __MPF_ImageResizeHandler(&$arCustomFile, $arParams = null) { static $arResizeParams = array(); if ($arParams !== null) { if (is_array($arParams) && array_key_exists("width", $arParams) && array_key_exists("height", $arParams)) { $arResizeParams = $arParams; } elseif(intVal($arParams) > 0) { $arResizeParams = array("width" => intVal($arParams), "height" => intVal($arParams)); } } if ((!is_array($arCustomFile)) || !isset($arCustomFile['fileID'])) return false; $fileID = $arCustomFile['fileID']; if (!isset($arCustomFile['fileContentType'])) { $arFile = CFile::GetFileArray($fileID); $arCustomFile['fileContentType'] = $arFile['CONTENT_TYPE']; $arCustomFile["fileSrc"] = $arFile["SRC"]; } if (strpos($arCustomFile['fileContentType'], 'image/') === 0) { $aImgThumb = CFile::ResizeImageGet( $fileID, array("width" => 90, "height" => 90), BX_RESIZE_IMAGE_EXACT, true ); $arCustomFile['img_thumb_src'] = $aImgThumb['src']; if (!empty($arResizeParams)) { $aImgSource = CFile::ResizeImageGet( $fileID, array("width" => $arResizeParams["width"], "height" => $arResizeParams["height"]), BX_RESIZE_IMAGE_PROPORTIONAL, true ); $arCustomFile['img_source_src'] = $aImgSource['src']; $arCustomFile['img_source_width'] = $aImgSource['width']; $arCustomFile['img_source_height'] = $aImgSource['height']; } } }
protected function handlerAnResizeImg($arResult, $arSizeSmail) { foreach ($arResult['elements'] as $key => $arItem) { if (!empty($arItem['DETAIL_PICTURE'])) { $arFileTmp = CFile::ResizeImageGet($arItem['DETAIL_PICTURE'], ['width' => $arSizeSmail['WIDTH_PICTURE_SMALL'], 'height' => $arSizeSmail['HEIGHT_PICTURE_SMALL']], BX_RESIZE_IMAGE_EXACT, false); $arSize = getimagesize($_SERVER['DOCUMENT_ROOT'] . $arFileTmp['src']); $arResult['elements'][$key]['SMALL_PICTURE'] = ['SRC' => $arFileTmp['src'], 'WIDTH' => IntVal($arSize[0]), 'HEIGHT' => IntVal($arSize[1]), 'TITLE' => $arItem['DETAIL_PICTURE']['TITLE'], 'ALT' => $arItem['DETAIL_PICTURE']['ALT']]; } else { $arResult['elements'][$key]['SMALL_PICTURE'] = array('SRC' => 'http://placehold.it/360x240', 'ALT' => 'placehold'); } } return $arResult; }
public function exec($mode = "basic", $params = array()) { $res = $this->check($params); if ($this->check($params)) { $this->file = \CFile::getByID($this->id)->fetch(); if ($mode == "resize" && ($file = \CFile::ResizeImageGet($this->id, $params, BX_RESIZE_IMAGE_PROPORTIONAL, true)) && $file) { $this->file["SRC"] = $file["src"]; $this->file["WIDTH"] = $file["width"]; $this->file["HEIGHT"] = $file["height"]; $this->file["FILE_SIZE"] = $file["size"]; } \CFile::ViewByUser($this->file, array("force_download" => false, 'cache_time' => 0)); } }
/** * Created by PhpStorm. * User: TzepART * Date: 25.09.2015 * Time: 13:00 */ function userInfo($user_id) { $arResult = array(); $rsUser = CUser::GetByID($user_id); $arUser = $rsUser->Fetch(); $imageFile = CFile::GetFileArray($arUser["PERSONAL_PHOTO"]); $arFileTmp = CFile::ResizeImageGet($imageFile, array("width" => 300, "height" => 300), BX_RESIZE_IMAGE_EXACT, false); $arResult['IMG'] = $arFileTmp["src"]; $arResult['LAST_NAME'] = $arUser['LAST_NAME']; $arResult['NAME'] = $arUser['NAME']; $arResult['CITY'] = $arUser["PERSONAL_CITY"]; $arResult['EMAIL'] = $arUser["EMAIL"]; return $arResult; }
public function getFileIcon() { $ext = strtolower($this->path_parts["extension"]); if (in_array($ext, array('png', 'jpg', 'jpeg', 'gif'))) { $icon = CFile::ResizeImageGet($this->file, array('width' => 256, 'height' => 256), BX_RESIZE_IMAGE_EXACT, true); $icon = $icon['src']; } if (in_array($ext, array('ac3', 'doc', 'mp3', 'php', 'pyc', 'rpm', 'xcf', 'js', 'tgz', 'xls', 'bmp', 'gz', 'py', 'svg', 'txt', 'tiff', 'zip', 'c', 'html', 'pdf', 'psd', 'rar', 'tga', 'docx'))) { $icon = self::$iconsPath . $ext . '.png'; } if (!$icon) { $icon = self::$iconsPath . 'other.png'; } return $icon; }
function __MPF_ImageResizeHandler(&$arCustomFile) { $arResizeParams = array("width" => 400, "height" => 400); if (!is_array($arCustomFile) || !isset($arCustomFile['fileID'])) { return false; } $fileID = $arCustomFile['fileID']; $arFile = CFile::MakeFileArray($fileID); if (CFile::CheckImageFile($arFile) === null) { $aImgThumb = CFile::ResizeImageGet($fileID, array("width" => 90, "height" => 90), BX_RESIZE_IMAGE_EXACT, true); $arCustomFile['img_thumb_src'] = $aImgThumb['src']; if (!empty($arResizeParams)) { $aImgSource = CFile::ResizeImageGet($fileID, array("width" => $arResizeParams["width"], "height" => $arResizeParams["height"]), BX_RESIZE_IMAGE_PROPORTIONAL, true); $arCustomFile['img_source_src'] = $aImgSource['src']; $arCustomFile['img_source_width'] = $aImgSource['width']; $arCustomFile['img_source_height'] = $aImgSource['height']; } } }
public function getProduct($product_id, $big = false) { $data = array(); $arSelect = array("IBLOCK_ID", "ID", "NAME", "PREVIEW_PICTURE", "DETAIL_PICTURE", "CATALOG_GROUP_1", "PREVIEW_TEXT", "PROPERTY_DESCRIPTION", "CODE"); $arFilter = array("IBLOCK_ID" => $this->iblock_id, "ID" => $product_id, "ACTIVE" => "Y"); $res = CIBlockElement::GetList(array(), $arFilter, false, false, $arSelect); if ($ob = $res->GetNextElement()) { $arFields = $ob->GetFields(); $small_file = CFile::ResizeImageGet($arFields['PREVIEW_PICTURE'], array('width' => 300 * 1.5, 'height' => 199 * 1.5), BX_RESIZE_IMAGE_EXACT, true, false, false, 100); $big_file = CFile::ResizeImageGet($arFields['DETAIL_PICTURE'], array('width' => 638 * 1.5, 'height' => 427 * 1.5), BX_RESIZE_IMAGE_EXACT, true, false, false, 100); $data = array('NAME' => $arFields['NAME'], 'TEXT' => $arFields['PREVIEW_TEXT'], 'PREVIEW_PICTURE' => $small_file['src'], 'DETAIL_PICTURE' => $big_file['src'], 'PRICE' => number_format($arFields['CATALOG_PRICE_1'], -1, ',', ' '), 'DESCRIPTION' => $arFields['PREVIEW_TEXT'], 'CODE' => $arFields['CODE']); if (true === $big) { $data['DESCRIPTION'] = $arFields['PROPERTY_DESCRIPTION_VALUE']['TEXT']; } if ($price = $this->checkOffers($product_id)) { $data['PRICE'] = number_format($price, -1, ',', ' '); } return $data; } }
public static function getUsersArrByIds($usersIds) { if (!$usersIds) { $usersIds = array(CUser::GetID()); } if (!is_array($usersIds)) { $usersIds = array($usersIds); } if (!count($usersIds)) { return; } $usersIds = array_unique($usersIds); $otherUsersIds = array(); foreach ($usersIds as $id) { $id = intval($id); if (!$id) { continue; } if (isset(self::$usersCache[$id])) { $users[$id] = self::$usersCache[$id]; } else { $otherUsersIds[] = $id; } } if (count($otherUsersIds)) { $rsUsers = CUser::GetList($by = "NAME", $order = "ASCS", array('ACTIVE' => 'Y', 'ID' => implode(' | ', $otherUsersIds)), array('FIELDS' => array('ID', 'NAME', 'LOGIN', 'LAST_NAME', 'PERSONAL_PHOTO', 'EMAIL', 'IS_ONLINE'))); while ($arUser = $rsUsers->Fetch()) { if ($arUser['PERSONAL_PHOTO']) { $arimg = CFile::ResizeImageGet($arUser['PERSONAL_PHOTO'], array('width' => 100, 'height' => 100), BX_RESIZE_IMAGE_EXACT, true); $src = $arimg['src']; } else { $src = self::$defaultUserPicture; } $arUser['PERSONAL_PHOTO'] = $src; $arUser['FULL_NAME'] = $arUser['NAME'] . ' ' . $arUser['LAST_NAME']; self::$usersCache[$arUser['ID']] = $arUser; $users[$arUser['ID']] = $arUser; } } return $users; }
protected function processActionShowProcesses() { $this->iblockTypeId = COption::GetOptionString("lists", "livefeed_iblock_type_id"); $this->checkPermission(); if ($this->errorCollection->hasErrors()) { $this->sendJsonErrorResponse(); } $siteDir = '/'; $siteId = true; if ($this->request->getPost('siteDir')) { $siteDir = $this->request->getPost('siteDir'); } if ($this->request->getPost('siteId')) { $siteId = $this->request->getPost('siteId'); } $path = rtrim($siteDir, '/'); $listData = array(); $lists = CIBlock::getList(array("SORT" => "ASC", "NAME" => "ASC"), array("ACTIVE" => "Y", "TYPE" => $this->iblockTypeId, "SITE_ID" => $siteId)); while ($list = $lists->fetch()) { if (CLists::getLiveFeed($list['ID'])) { $listData[$list['ID']]['name'] = $list['NAME']; $listData[$list['ID']]['url'] = $path . COption::GetOptionString('lists', 'livefeed_url') . '?livefeed=y&list_id=' . $list["ID"] . '&element_id=0'; if ($list['PICTURE'] > 0) { $imageFile = CFile::GetFileArray($list['PICTURE']); if ($imageFile !== false) { $imageFile = CFile::ResizeImageGet($imageFile, array("width" => 36, "height" => 30), BX_RESIZE_IMAGE_PROPORTIONAL, false); $listData[$list['ID']]['picture'] = '<img src="' . $imageFile["src"] . '" width="19" height="16" border="0" />'; } } else { $listData[$list['ID']]['picture'] = '<img src="/bitrix/images/lists/default.png" width="19" height="16" border="0" />'; } } } if (!empty($listData)) { $this->sendJsonSuccessResponse(array('lists' => $listData)); } else { $this->errorCollection->add(array(new Error(Loc::getMessage('LISTS_SEAC_NOT_PROCESSES')))); $this->sendJsonErrorResponse(); } }
protected function processActionGetListAdmin() { $this->checkRequiredPostParams(array('iblockId')); if ($this->errorCollection->hasErrors()) { $this->sendJsonErrorResponse(); } $this->iblockId = intval($this->request->getPost('iblockId')); $this->iblockTypeId = COption::GetOptionString("lists", "livefeed_iblock_type_id"); $this->checkPermissionElement(); if ($this->errorCollection->hasErrors()) { $this->sendJsonErrorResponse(); } $rightObject = new CIBlockRights($this->iblockId); $rights = $rightObject->getRights(); $rightsList = $rightObject->getRightsList(false); $idRight = array_search('iblock_full', $rightsList); $listUser = array(); $nameTemplate = CSite::GetNameFormat(false); foreach ($rights as $right) { $res = strpos($right['GROUP_CODE'], 'U'); if ($right['TASK_ID'] == $idRight && $res === 0) { $userId = substr($right['GROUP_CODE'], 1); $users = CUser::GetList($by = "id", $order = "asc", array('ID' => $userId), array('FIELDS' => array('ID', 'PERSONAL_PHOTO', 'NAME', 'LAST_NAME'))); $user = $users->fetch(); $file['src'] = ''; if ($user) { $file = \CFile::ResizeImageGet($user['PERSONAL_PHOTO'], array('width' => 58, 'height' => 58), \BX_RESIZE_IMAGE_EXACT, false); } $listUser[$userId]['id'] = $userId; $listUser[$userId]['img'] = $file['src']; $listUser[$userId]['name'] = CUser::FormatName($nameTemplate, $user, false); } } $users = CUser::getList($b = 'ID', $o = 'ASC', array('GROUPS_ID' => 1, 'ACTIVE' => 'Y'), array('FIELDS' => array('ID', 'PERSONAL_PHOTO', 'NAME', 'LAST_NAME'))); while ($user = $users->fetch()) { $file = \CFile::ResizeImageGet($user['PERSONAL_PHOTO'], array('width' => 58, 'height' => 58), \BX_RESIZE_IMAGE_EXACT, false); $listUser[$user['ID']]['id'] = $user['ID']; $listUser[$user['ID']]['img'] = $file['src']; $listUser[$user['ID']]['name'] = CUser::FormatName($nameTemplate, $user, false); } $listUser = array_values($listUser); $this->sendJsonSuccessResponse(array('listAdmin' => $listUser)); }
public function getSkuPropsData($arBasketItems, $arParents, $arSkuProps = array()) { $arRes = array(); $arSkuIblockID = array(); if (is_array($arParents)) { foreach ($arBasketItems as &$arItem) { if (array_key_exists($arItem["PRODUCT_ID"], $arParents)) { $arSKU = CCatalogSKU::GetInfoByProductIBlock($arParents[$arItem["PRODUCT_ID"]]["IBLOCK_ID"]); if (!array_key_exists($arSKU["IBLOCK_ID"], $arSkuIblockID)) { $arSkuIblockID[$arSKU["IBLOCK_ID"]] = $arSKU; } $arItem["IBLOCK_ID"] = $arSKU["IBLOCK_ID"]; $arItem["SKU_PROPERTY_ID"] = $arSKU["SKU_PROPERTY_ID"]; } } unset($arItem); foreach ($arSkuIblockID as $skuIblockID => $arSKU) { // possible props values $rsProps = CIBlockProperty::GetList(array('SORT' => 'ASC', 'ID' => 'ASC'), array('IBLOCK_ID' => $skuIblockID, 'ACTIVE' => 'Y')); while ($arProp = $rsProps->Fetch()) { if ($arProp['PROPERTY_TYPE'] == 'L' || $arProp['PROPERTY_TYPE'] == 'E' || $arProp['PROPERTY_TYPE'] == 'S' && $arProp['USER_TYPE'] == 'directory') { if ($arProp['XML_ID'] == 'CML2_LINK') { continue; } if (!in_array($arProp['CODE'], $arSkuProps)) { continue; } $arValues = array(); if ($arProp['PROPERTY_TYPE'] == 'L') { $arValues = array(); $rsPropEnums = CIBlockProperty::GetPropertyEnum($arProp['ID']); while ($arEnum = $rsPropEnums->Fetch()) { $arValues['n' . $arEnum['ID']] = array('ID' => $arEnum['ID'], 'NAME' => $arEnum['VALUE'], 'PICT' => false); } } elseif ($arProp['PROPERTY_TYPE'] == 'E') { $rsPropEnums = CIBlockElement::GetList(array('SORT' => 'ASC'), array('IBLOCK_ID' => $arProp['LINK_IBLOCK_ID'], 'ACTIVE' => 'Y'), false, false, array('ID', 'NAME', 'PREVIEW_PICTURE')); while ($arEnum = $rsPropEnums->Fetch()) { $arEnum['PREVIEW_PICTURE'] = CFile::GetFileArray($arEnum['PREVIEW_PICTURE']); if (!is_array($arEnum['PREVIEW_PICTURE'])) { $arEnum['PREVIEW_PICTURE'] = false; } if ($arEnum['PREVIEW_PICTURE'] !== false) { $productImg = CFile::ResizeImageGet($arEnum['PREVIEW_PICTURE'], array('width' => 80, 'height' => 80), BX_RESIZE_IMAGE_PROPORTIONAL, false, false); $arEnum['PREVIEW_PICTURE']['SRC'] = $productImg['src']; } $arValues['n' . $arEnum['ID']] = array('ID' => $arEnum['ID'], 'NAME' => $arEnum['NAME'], 'SORT' => $arEnum['SORT'], 'PICT' => $arEnum['PREVIEW_PICTURE']); } } elseif ($arProp['PROPERTY_TYPE'] == 'S' && $arProp['USER_TYPE'] == 'directory') { if (self::$highLoadInclude === null) { self::$highLoadInclude = Loader::includeModule('highloadblock'); } if (self::$highLoadInclude) { $hlblock = HL\HighloadBlockTable::getList(array("filter" => array("=TABLE_NAME" => $arProp["USER_TYPE_SETTINGS"]["TABLE_NAME"])))->fetch(); if ($hlblock) { $entity = HL\HighloadBlockTable::compileEntity($hlblock); $entity_data_class = $entity->getDataClass(); $rsData = $entity_data_class::getList(); while ($arData = $rsData->fetch()) { $arValues['n' . $arData['ID']] = array('ID' => $arData['ID'], 'NAME' => $arData['UF_NAME'], 'SORT' => $arData['UF_SORT'], 'FILE' => $arData['UF_FILE'], 'PICT' => false, 'XML_ID' => $arData['UF_XML_ID']); } } } } if (!empty($arValues) && is_array($arValues)) { $arRes[$skuIblockID][$arProp['ID']] = array('ID' => $arProp['ID'], 'CODE' => $arProp['CODE'], 'NAME' => $arProp['NAME'], 'TYPE' => $arProp['PROPERTY_TYPE'], 'USER_TYPE' => $arProp['USER_TYPE'], 'VALUES' => $arValues); } } } } foreach ($arBasketItems as &$arItem) { if (isset($arItem["IBLOCK_ID"]) && (int) $arItem["IBLOCK_ID"] > 0 && isset($arRes[$arItem["IBLOCK_ID"]])) { $arItem["SKU_DATA"] = $arRes[$arItem["IBLOCK_ID"]]; $arUsedValues = array(); $arTmpRes = array(); $arOfFilter = array("IBLOCK_ID" => $arItem["IBLOCK_ID"], "PROPERTY_" . $arSkuIblockID[$arItem["IBLOCK_ID"]]["SKU_PROPERTY_ID"] => $arParents[$arItem["PRODUCT_ID"]]["PRODUCT_ID"]); $rsOffers = CIBlockElement::GetList(array(), $arOfFilter, false, false, array("ID", "IBLOCK_ID")); while ($obOffer = $rsOffers->GetNextElement()) { $arProps = $obOffer->GetProperties(); foreach ($arProps as $propName => $propValue) { if (in_array($propName, $arSkuProps)) { if (array_key_exists('VALUE', $propValue)) { if (strlen($propValue['VALUE']) > 0 && (!is_array($arUsedValues[$arItem["PRODUCT_ID"]][$propName]) || !in_array($propValue['VALUE'], $arUsedValues[$arItem["PRODUCT_ID"]][$propName]))) { $arUsedValues[$arItem["PRODUCT_ID"]][$propName][] = $propValue['VALUE']; } } } } } if (!empty($arUsedValues)) { // add only used values to the item SKU_DATA foreach ($arRes[$arItem["IBLOCK_ID"]] as $propId => $arProp) { if (!array_key_exists($arProp["CODE"], $arUsedValues[$arItem["PRODUCT_ID"]])) { continue; } $arTmpRes['n' . $propId] = array(); foreach ($arProp["VALUES"] as $valId => $arValue) { // properties of various type have different values in the used values data if ($arProp["TYPE"] == "L" && in_array($arValue["NAME"], $arUsedValues[$arItem["PRODUCT_ID"]][$arProp["CODE"]]) || $arProp["TYPE"] == "E" && in_array($arValue["ID"], $arUsedValues[$arItem["PRODUCT_ID"]][$arProp["CODE"]]) || $arProp["TYPE"] == "S" && in_array($arValue["XML_ID"], $arUsedValues[$arItem["PRODUCT_ID"]][$arProp["CODE"]])) { if ($arProp["TYPE"] == "S") { if (!empty($arValue["FILE"])) { $arTmpFile = CFile::GetFileArray($arValue["FILE"]); if (!empty($arTmpFile)) { $tmpImg = CFile::ResizeImageGet($arTmpFile, array('width' => 80, 'height' => 80), BX_RESIZE_IMAGE_PROPORTIONAL, false, false); $arValue['PICT']['SRC'] = $tmpImg['src']; } } } $arTmpRes['n' . $propId]["CODE"] = $arProp["CODE"]; $arTmpRes['n' . $propId]["NAME"] = $arProp["NAME"]; $arTmpRes['n' . $propId]["VALUES"][$valId] = $arValue; } } } } $arItem["SKU_DATA"] = $arTmpRes; } } unset($arItem); } return $arBasketItems; }
function socialnetworkBlogPostCommentWeb(array $comment, array $arParams, array $arResult, SocialnetworkBlogPostComment $component) { global $APPLICATION; $arParams["AVATAR_SIZE"] = intval($arParams["AVATAR_SIZE"]) ?: 58; $arAvatarSizes = array("AVATAR_SIZE" => intval(array_key_exists("AVATAR_SIZE_COMMON", $arParams) ? $arParams["AVATAR_SIZE_COMMON"] : $arParams["AVATAR_SIZE"]), "AVATAR_SIZE_COMMENT" => intval($arParams["AVATAR_SIZE_COMMENT"])); $arAvatarSizes["AVATAR_SIZE"] = $arAvatarSizes["AVATAR_SIZE"] > 0 ? $arAvatarSizes["AVATAR_SIZE"] : 42; // reference to CBlogUser::GetUserInfoArray $arAvatarSizes["AVATAR_SIZE_COMMENT"] = $arAvatarSizes["AVATAR_SIZE_COMMENT"] > 0 ? $arAvatarSizes["AVATAR_SIZE_COMMENT"] : 42; // reference to CBlogUser::GetUserInfoArray $avatarKey = "PERSONAL_PHOTO_RESIZED"; if ($arAvatarSizes["AVATAR_SIZE"] == $arParams["AVATAR_SIZE"]) { $avatarKey = "PERSONAL_PHOTO_resized"; } else { if ($arAvatarSizes["AVATAR_SIZE_COMMENT"] == $arParams["AVATAR_SIZE"]) { $avatarKey = "PERSONAL_PHOTO_resized_30"; } } $arUser = $arResult["userCache"][$comment["AUTHOR_ID"]]; if (is_array($arUser) && !array_key_exists($avatarKey, $arUser) && intval($arUser["PERSONAL_PHOTO"]) > 0) { $arResult["userCache"][$comment["AUTHOR_ID"]][$avatarKey] = CFile::ResizeImageGet($arUser["PERSONAL_PHOTO"], array("width" => $arParams["AVATAR_SIZE"], "height" => $arParams["AVATAR_SIZE"]), BX_RESIZE_IMAGE_EXACT); $arUser = $arResult["userCache"][$comment["AUTHOR_ID"]]; } $text = $comment["TextFormated"]; if (!$component->isWeb()) { static $parser = null; if ($parser == null) { $parser = new blogTextParser(false, $arParams["PATH_TO_SMILE"]); $parser->bMobile = false; $parser->LAZYLOAD = isset($arParams["LAZYLOAD"]) && $arParams["LAZYLOAD"] == "Y" ? "Y" : "N"; } if (is_array($comment["COMMENT_PROPERTIES"]["DATA"]["UF_BLOG_COMMENT_FILE"])) { $parser->arUserfields = array("UF_BLOG_COMMENT_FILE" => array_merge($comment["COMMENT_PROPERTIES"]["DATA"]["UF_BLOG_COMMENT_FILE"], array("TAG" => "DOCUMENT ID"))); } $text = $parser->convert($comment["POST_TEXT"], false, $comment["showedImages"], array("HTML" => "N", "ANCHOR" => "Y", "BIU" => "Y", "IMG" => "Y", "QUOTE" => "Y", "CODE" => "Y", "FONT" => "Y", "LIST" => "Y", "SMILES" => "Y", "NL2BR" => "N", "VIDEO" => COption::GetOptionString("blog", "allow_video", "Y") != "Y" || $arParams["ALLOW_VIDEO"] != "Y" ? "N" : "Y", "SHORT_ANCHOR" => "Y"), array("imageWidth" => $arParams["IMAGE_MAX_WIDTH"], "imageHeight" => $arParams["IMAGE_MAX_HEIGHT"])); } $res = array("ID" => $comment["ID"], "NEW" => $arParams["FOLLOW"] != "N" && $comment["NEW"] == "Y" ? "Y" : "N", "APPROVED" => $comment["PUBLISH_STATUS"] == BLOG_PUBLISH_STATUS_PUBLISH ? "Y" : "N", "POST_TIMESTAMP" => !empty($comment["DATE_CREATE_TS"]) ? $comment["DATE_CREATE_TS"] + $arResult["TZ_OFFSET"] : MakeTimeStamp($comment["DATE_CREATE"]) - $arResult["TZ_OFFSET"], "AUTHOR" => array("ID" => is_array($arUser) ? $arUser["ID"] : false, "NAME" => is_array($arUser) ? $arUser["~NAME"] : '', "LAST_NAME" => is_array($arUser) ? $arUser["~LAST_NAME"] : '', "SECOND_NAME" => is_array($arUser) ? $arUser["~SECOND_NAME"] : '', "AVATAR" => is_array($arUser) && array_key_exists($avatarKey, $arUser) ? $arUser[$avatarKey]["src"] : ''), "FILES" => false, "UF" => false, "POST_MESSAGE_TEXT" => $text, "~POST_MESSAGE_TEXT" => $comment["POST_TEXT"], "CLASSNAME" => "", "BEFORE_HEADER" => "", "BEFORE_ACTIONS" => "", "AFTER_ACTIONS" => "", "AFTER_HEADER" => "", "BEFORE" => "", "AFTER" => "", "BEFORE_RECORD" => "", "AFTER_RECORD" => ""); $aditStyle = ($comment["AuthorIsAdmin"] == "Y" ? "blog-comment-admin" : "") . ($comment["AuthorIsPostAuthor"] == "Y" ? "blog-comment-author" : ""); if ($aditStyle) { $res["BEFORE_RECORD"] = "<div class='" . $aditStyle . "'>"; $res["AFTER_RECORD"] = "</div>"; } if (!empty($arResult["arImages"][$comment["ID"]])) { $res["FILES"] = array(); foreach ($arResult["arImages"][$comment["ID"]] as $i => $val) { $t = $arResult["Images"][$i]; $res["FILES"][] = array("THUMBNAIL" => $val["small"], "SRC" => $val["full"], "FILE_SIZE" => $t["source"]["size"], "CONTENT_TYPE" => "image/xyz", "ORIGINAL_NAME" => $t["fileName"], "FILE_NAME" => $t["fileName"]); } } if ($comment["COMMENT_PROPERTIES"]["SHOW"] == "Y") { $res["UF"] = $comment["COMMENT_PROPERTIES"]["DATA"]; foreach ($res["UF"] as $key => $arPostField) { if (!empty($arPostField["VALUE"])) { $res["UF"][$key]['POST_ID'] = $arParams['POST_DATA']['ID']; $res["UF"][$key]['URL_TO_POST'] = str_replace('#source_post_id#', $arPostField['POST_ID'], $arResult['urlToPost']); } } } ob_start(); ?> <script> top.text<?php echo $comment["ID"]; ?> = text<?php echo $comment["ID"]; ?> = '<?php echo CUtil::JSEscape($comment["POST_TEXT"]); ?> '; top.title<?php echo $comment["ID"]; ?> = title<?php echo $comment["ID"]; ?> = '<?php echo CUtil::JSEscape($comment["TITLE"]); ?> '; top.arComFiles<?php echo $comment["ID"]; ?> = [];<?php if ($comment["COMMENT_PROPERTIES"]["DATA"]) { foreach ($comment["COMMENT_PROPERTIES"]["DATA"] as $userField) { if (empty($userField["VALUE"])) { continue; } else { if ($userField["USER_TYPE_ID"] == "disk_file") { ?> top.arComDFiles<?php echo $comment["ID"]; ?> = BX.util.array_merge((top.arComDFiles<?php echo $comment["ID"]; ?> || []), <?php echo CUtil::PhpToJSObject($userField["VALUE"]); ?> ); <?php } else { if ($userField["USER_TYPE_ID"] == "webdav_element") { ?> top.arComDocs<?php echo $comment["ID"]; ?> = BX.util.array_merge((top.arComDocs<?php echo $comment["ID"]; ?> || []), <?php echo CUtil::PhpToJSObject($userField["VALUE"]); ?> ); <?php } else { if ($userField["USER_TYPE_ID"] == "file") { ?> top.arComFilesUf<?php echo $comment["ID"]; ?> = BX.util.array_merge((top.arComDocs<?php echo $comment["ID"]; ?> || []), <?php echo CUtil::PhpToJSObject($userField["VALUE"]); ?> ); <?php } } } } } } if (is_array($comment["COMMENT_PROPERTIES"]["HIDDEN_DATA"])) { foreach ($comment["COMMENT_PROPERTIES"]["HIDDEN_DATA"] as $userField) { if (empty($userField["VALUE"])) { continue; } else { if ($userField["USER_TYPE_ID"] == "url_preview") { ?> top.UrlPreview<?php echo $comment["ID"]; ?> = '<?php echo CUtil::JSEscape($userField["VALUE"]); ?> '; <?php } } } } if (!empty($comment["showedImages"])) { foreach ($comment["showedImages"] as $imgId) { if (!empty($arResult["Images"][$imgId])) { ?> top.arComFiles<?php echo $comment["ID"]; ?> .push({ id : '<?php echo $imgId; ?> ', name : '<?php echo CUtil::JSEscape($arResult["Images"][$imgId]["fileName"]); ?> ', type: 'image', src: '<?php echo CUtil::JSEscape($arResult["Images"][$imgId]["source"]["src"]); ?> ', thumbnail: '<?php echo CUtil::JSEscape($arResult["Images"][$imgId]["src"]); ?> ', isImage: true });<?php } } } ?> </script><?php $res["AFTER"] .= ob_get_clean(); return $res; }
if ($perms != BLOG_PERMS_DENY) { $SORT = array($arParams["SORT_BY1"] => $arParams["SORT_ORDER1"], $arParams["SORT_BY2"] => $arParams["SORT_ORDER2"]); if ($arParams["MESSAGE_COUNT"] > 0) { $COUNT = array("nTopCount" => $arParams["MESSAGE_COUNT"]); } else { $COUNT = false; } $ids = array(); $dbPosts = CBlogPost::GetList($SORT, $arFilter, false, $COUNT, $arSelectedFields); $p = new blogTextParser(false, $arParams["PATH_TO_SMILE"]); $itemCnt = 0; while ($arPost = $dbPosts->GetNext()) { if (IntVal($arPost["ATTACH_IMG"]) <= 0) { $dbImage = CBlogImage::GetList(array("ID" => "ASC"), array("BLOG_ID" => $arPost["BLOG_ID"], "POST_ID" => $arPost["ID"], "IS_COMMENT" => "N")); if ($arImage = $dbImage->Fetch()) { if ($file = CFile::ResizeImageGet($arImage["FILE_ID"], array("width" => $arParams["PREVIEW_WIDTH"], "height" => $arParams["PREVIEW_HEIGHT"]))) { $arPost["IMG"] = CFile::ShowImage($file["src"], false, false, 'align="left" hspace="2" vspace="2"'); } } } else { $arPost["IMG"] = CFile::ShowImage($arPost["ATTACH_IMG"], false, false, 'align="left" hspace="2" vspace="2"'); } $arTmp = $arPost; if ($arTmp["AUTHOR_ID"] == $arTmp["BLOG_OWNER_ID"]) { $arTmp["urlToBlog"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_BLOG"], array("blog" => $arPost["BLOG_URL"], "user_id" => $arPost["AUTHOR_ID"])); } else { if ($arParams["USE_SOCNET"] == "Y" && IntVal($arParams["SOCNET_GROUP_ID"]) > 0) { $arTmp["urlToBlog"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arPost["AUTHOR_ID"])); } else { $arOwnerBlog = CBlog::GetByOwnerID($arTmp["AUTHOR_ID"], $arParams["GROUP_ID"]); if (!empty($arOwnerBlog)) {
<?php if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) { die; } ?> <?php CModule::IncludeModule('iblock'); foreach ($arResult["ITEMS"] as $key => $arItem) { $arResult["ITEMS"][$key]["SMALL_PIC"] = CFile::ResizeImageGet($arItem['PREVIEW_PICTURE'], array("width" => 88, "height" => 88), BX_RESIZE_IMAGE_EXACT, true, $arFilter); }