当前位置: 首页>>代码示例>>PHP>>正文


PHP CFile::ResizeImageGet方法代码示例

本文整理汇总了PHP中CFile::ResizeImageGet方法的典型用法代码示例。如果您正苦于以下问题:PHP CFile::ResizeImageGet方法的具体用法?PHP CFile::ResizeImageGet怎么用?PHP CFile::ResizeImageGet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CFile的用法示例。


在下文中一共展示了CFile::ResizeImageGet方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getProductInfo

 /** 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;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:33,代码来源:store_utility.php

示例2: GetResizedImage

function GetResizedImage($id, $width, $height)
{
    $arSize = array("width" => $width, "height" => $height);
    $file = CFile::GetFileArray($id);
    $resized = CFile::ResizeImageGet($file, $arSize);
    return $resized;
}
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:7,代码来源:init.php

示例3: __mpl_get_avatar

	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;
	}
开发者ID:ASDAFF,项目名称:entask.ru,代码行数:25,代码来源:messages.php

示例4: __main_post_form_image_resize

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'];
        }
    }
}
开发者ID:Satariall,项目名称:izurit,代码行数:35,代码来源:functions.php

示例5: __MPF_ImageResizeHandler

 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'];
         }
     }
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:26,代码来源:result_modifier.php

示例6: getCradoBaners

 /**
  * ’эндлер, отслеживающий изменени¤ в инфоблоках
  * @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;
 }
开发者ID:CheBurashka334,项目名称:crado,代码行数:35,代码来源:cCradoBaners.php

示例7: getProductInfo

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;
    }
}
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:28,代码来源:cat_store_document.php

示例8: getImageByID

 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);
 }
开发者ID:Reprezo,项目名称:digitalwand.admin_helper,代码行数:8,代码来源:ImageWidget.php

示例9: getUserPhotoSrc

 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'];
 }
开发者ID:Satariall,项目名称:izurit,代码行数:8,代码来源:viewhelper.php

示例10: 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;
 }
开发者ID:ASDAFF,项目名称:stex,代码行数:15,代码来源:class.php

示例11: getStartedByPhoto

 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;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:9,代码来源:class.php

示例12: waterImage

/**
 * [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;
}
开发者ID:akniyev,项目名称:arteva.ru,代码行数:14,代码来源:functions.php

示例13: resize

 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;
 }
开发者ID:sharapudinov,项目名称:lovestore.top,代码行数:10,代码来源:functions.php

示例14: socialnetworkBlogPostCommentMobile

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;
}
开发者ID:Satariall,项目名称:izurit,代码行数:54,代码来源:functions.php

示例15: getResized

 /**
  * Возвращает массив с данными о картинке, пережатой до нужных размеров
  * @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;
 }
开发者ID:marvin255,项目名称:bxar,代码行数:15,代码来源:File.php


注:本文中的CFile::ResizeImageGet方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。