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


PHP CFile::ScaleImage方法代码示例

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


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

示例1: array

<?php

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
$arResult["ELEMENT"]["URL"]["~DOWNLOAD"] = $arResult["ELEMENT"]["URL"]["DOWNLOAD"];
if (!isset($arParams["THUMB_SIZE"]) && isset($_REQUEST["size"])) {
    $arParams["THUMB_SIZE"] = $_REQUEST["size"] > 0 && $_REQUEST["size"] < 600 ? $_REQUEST["size"] : 600;
}
if (isset($arParams["THUMB_SIZE"])) {
    if (CFile::IsImage($arResult["ELEMENT"]['NAME'], $arResult["ELEMENT"]['FILE']["CONTENT_TYPE"])) {
        CFile::ScaleImage($arResult["ELEMENT"]["FILE"]["WIDTH"], $arResult["ELEMENT"]["FILE"]["HEIGHT"], array("width" => $arParams["THUMB_SIZE"], "height" => $arParams["THUMB_SIZE"]), BX_RESIZE_IMAGE_PROPORTIONAL, $bNeedCreatePicture, $arSourceSize, $arDestinationSize);
        if ($bNeedCreatePicture) {
            $arResult["ELEMENT"]["original"] = array("src" => $arResult["ELEMENT"]["URL"]["DOWNLOAD"], "width" => $arResult["ELEMENT"]["FILE"]["WIDTH"], "height" => $arResult["ELEMENT"]["FILE"]["HEIGHT"]);
            $arResult["ELEMENT"]["FILE"]["WIDTH"] = $arDestinationSize["width"];
            $arResult["ELEMENT"]["FILE"]["HEIGHT"] = $arDestinationSize["height"];
            $arResult["ELEMENT"]["URL"]["DOWNLOAD"] = WDAddPageParams($arResult["ELEMENT"]["URL"]["DOWNLOAD"], array("cache_image" => "Y", "width" => $arParams["THUMB_SIZE"], "height" => $arParams["THUMB_SIZE"]));
        }
    }
}
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:20,代码来源:result_modifier.php

示例2: ResizeImageFileDelay

 public static function ResizeImageFileDelay(&$arDestinationSize, $sourceFile, $destinationFile, $arResizeParams)
 {
     global $DB;
     $destinationFile = preg_replace("/^https?:/i", "", $destinationFile);
     $q = $DB->Query("\n\t\t\tselect\n\t\t\t\tID\n\t\t\t\t,ERROR_CODE\n\t\t\t\t,PARAMS\n\t\t\t\t," . $DB->DateToCharFunction("TIMESTAMP_X", "FULL") . " TIMESTAMP_X\n\t\t\tfrom b_clouds_file_resize\n\t\t\twhere TO_PATH = '" . $DB->ForSql($destinationFile) . "'\n\t\t");
     if ($resize = $q->Fetch()) {
         if ($resize["ERROR_CODE"] === "0") {
             $arResizeParams = unserialize($resize["PARAMS"]);
             $id = $resize["ID"];
         } elseif (MakeTimeStamp($resize["TIMESTAMP_X"]) + 300 < time() + CTimeZone::GetOffset()) {
             $DB->Query("\n\t\t\t\t\tUPDATE b_clouds_file_resize\n\t\t\t\t\tSET ERROR_CODE='0'\n\t\t\t\t\tWHERE ID=" . $resize["ID"] . "\n\t\t\t\t");
             $arResizeParams = unserialize($resize["PARAMS"]);
             $id = $resize["ID"];
         } else {
             return false;
         }
     } else {
         $id = 0;
     }
     $sourceImageWidth = $sourceFile["WIDTH"];
     $sourceImageHeight = $sourceFile["HEIGHT"];
     $arSize = $arResizeParams[0];
     $resizeType = $arResizeParams[1];
     $arWaterMark = $arResizeParams[2];
     $jpgQuality = $arResizeParams[3];
     $arFilters = $arResizeParams[4];
     $bNeedCreatePicture = false;
     $arSourceSize = array("x" => 0, "y" => 0, "width" => 0, "height" => 0);
     $arDestinationSize = array("x" => 0, "y" => 0, "width" => 0, "height" => 0);
     CFile::ScaleImage($sourceImageWidth, $sourceImageHeight, $arSize, $resizeType, $bNeedCreatePicture, $arSourceSize, $arDestinationSize);
     $bNeedCreatePicture |= is_array($arWaterMark) && !empty($arWaterMark);
     $bNeedCreatePicture |= is_array($arFilters) && !empty($arFilters);
     if ($bNeedCreatePicture) {
         if ($id <= 0) {
             $id = $DB->Add("b_clouds_file_resize", array("~TIMESTAMP_X" => $DB->CurrentTimeFunction(), "ERROR_CODE" => "0", "PARAMS" => serialize($arResizeParams), "FROM_PATH" => $sourceFile["SRC"], "TO_PATH" => $destinationFile, "FILE_ID" => $sourceFile["ID"]));
         }
         return $id > 0;
     } else {
         return false;
     }
 }
开发者ID:rasuldev,项目名称:torino,代码行数:41,代码来源:storage.php

示例3: ResizeImageFile

 function ResizeImageFile($sourceFile, &$destinationFile, $arSize, $resizeType = BX_RESIZE_IMAGE_PROPORTIONAL, $arWaterMark = array(), $jpgQuality = false, $arFilters = false)
 {
     $io = CBXVirtualIo::GetInstance();
     if (!$io->FileExists($sourceFile)) {
         return false;
     }
     $bNeedCreatePicture = false;
     if ($resizeType != BX_RESIZE_IMAGE_EXACT && $resizeType != BX_RESIZE_IMAGE_PROPORTIONAL_ALT) {
         $resizeType = BX_RESIZE_IMAGE_PROPORTIONAL;
     }
     if (!is_array($arSize)) {
         $arSize = array();
     }
     if (!array_key_exists("width", $arSize) || intval($arSize["width"]) <= 0) {
         $arSize["width"] = 0;
     }
     if (!array_key_exists("height", $arSize) || intval($arSize["height"]) <= 0) {
         $arSize["height"] = 0;
     }
     $arSize["width"] = intval($arSize["width"]);
     $arSize["height"] = intval($arSize["height"]);
     $arSourceSize = array("x" => 0, "y" => 0, "width" => 0, "height" => 0);
     $arDestinationSize = array("x" => 0, "y" => 0, "width" => 0, "height" => 0);
     $arSourceFileSizeTmp = CFile::GetImageSize($sourceFile);
     if (!in_array($arSourceFileSizeTmp[2], array(IMAGETYPE_PNG, IMAGETYPE_JPEG, IMAGETYPE_GIF, IMAGETYPE_BMP))) {
         return false;
     }
     if (class_exists("imagick") && function_exists('memory_get_usage')) {
         //When memory limit reached we'll try to use ImageMagic
         $memoryNeeded = round(($arSourceFileSizeTmp[0] * $arSourceFileSizeTmp[1] * $arSourceFileSizeTmp['bits'] * ($arSourceFileSizeTmp['channels'] > 0 ? $arSourceFileSizeTmp['channels'] : 1) / 8 + pow(2, 16)) * 1.65);
         $memoryLimit = CUtil::Unformat(ini_get('memory_limit'));
         if (memory_get_usage() + $memoryNeeded > $memoryLimit) {
             if ($arSize["width"] <= 0 || $arSize["height"] <= 0) {
                 $arSize["width"] = $arSourceFileSizeTmp[0];
                 $arSize["height"] = $arSourceFileSizeTmp[1];
             }
             CFile::ScaleImage($arSourceFileSizeTmp[0], $arSourceFileSizeTmp[1], $arSize, $resizeType, $bNeedCreatePicture, $arSourceSize, $arDestinationSize);
             if ($bNeedCreatePicture) {
                 $new_image = CTempFile::GetFileName(bx_basename($sourceFile));
                 CheckDirPath($new_image);
                 $im = new Imagick();
                 try {
                     $im->setSize($arDestinationSize["width"], $arDestinationSize["height"]);
                     $im->readImage($io->GetPhysicalName($sourceFile));
                     $im->setImageFileName($new_image);
                     $im->thumbnailImage($arDestinationSize["width"], $arDestinationSize["height"], true);
                     $im->writeImage();
                     $im->destroy();
                 } catch (ImagickException $e) {
                     $new_image = "";
                 }
                 if ($new_image != "") {
                     $sourceFile = $new_image;
                     $arSourceFileSizeTmp = CFile::GetImageSize($io->GetPhysicalName($sourceFile));
                 }
             }
         }
     }
     if ($io->Copy($sourceFile, $destinationFile)) {
         switch ($arSourceFileSizeTmp[2]) {
             case IMAGETYPE_GIF:
                 $sourceImage = imagecreatefromgif($io->GetPhysicalName($sourceFile));
                 $bHasAlpha = true;
                 break;
             case IMAGETYPE_PNG:
                 $sourceImage = imagecreatefrompng($io->GetPhysicalName($sourceFile));
                 $bHasAlpha = true;
                 break;
             case IMAGETYPE_BMP:
                 $sourceImage = CFile::ImageCreateFromBMP($io->GetPhysicalName($sourceFile));
                 $bHasAlpha = false;
                 break;
             default:
                 $sourceImage = imagecreatefromjpeg($io->GetPhysicalName($sourceFile));
                 $bHasAlpha = false;
                 break;
         }
         $sourceImageWidth = intval(imagesx($sourceImage));
         $sourceImageHeight = intval(imagesy($sourceImage));
         if ($sourceImageWidth > 0 && $sourceImageHeight > 0) {
             if ($arSize["width"] <= 0 || $arSize["height"] <= 0) {
                 $arSize["width"] = $sourceImageWidth;
                 $arSize["height"] = $sourceImageHeight;
             }
             CFile::ScaleImage($sourceImageWidth, $sourceImageHeight, $arSize, $resizeType, $bNeedCreatePicture, $arSourceSize, $arDestinationSize);
             if ($bNeedCreatePicture) {
                 if (CFile::IsGD2()) {
                     $picture = ImageCreateTrueColor($arDestinationSize["width"], $arDestinationSize["height"]);
                     if ($arSourceFileSizeTmp[2] == IMAGETYPE_PNG) {
                         $transparentcolor = imagecolorallocatealpha($picture, 0, 0, 0, 127);
                         imagefilledrectangle($picture, 0, 0, $arDestinationSize["width"], $arDestinationSize["height"], $transparentcolor);
                         imagealphablending($picture, false);
                         imagecopyresampled($picture, $sourceImage, 0, 0, $arSourceSize["x"], $arSourceSize["y"], $arDestinationSize["width"], $arDestinationSize["height"], $arSourceSize["width"], $arSourceSize["height"]);
                         imagealphablending($picture, true);
                     } elseif ($arSourceFileSizeTmp[2] == IMAGETYPE_GIF) {
                         imagepalettecopy($picture, $sourceImage);
                         //Save transparency for GIFs
                         $transparentcolor = imagecolortransparent($sourceImage);
                         if ($transparentcolor >= 0 && $transparentcolor < imagecolorstotal($sourceImage)) {
                             $RGB = imagecolorsforindex($sourceImage, $transparentcolor);
//.........这里部分代码省略.........
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:101,代码来源:file.php

示例4: trim

$arParams["FAMILY"] = trim($arParams["FAMILY"]);
$arParams["FAMILY"] = strtolower(empty($arParams["FAMILY"]) ? "forum" : $arParams["FAMILY"]);
$arParams["FAMILY"] = preg_replace("/[^a-z]/is", "", $arParams["FAMILY"]);
$arParams["RETURN"] = $arParams["RETURN"] == "Y" ? "Y" : "N";
$arParams["MODE"] = trim($arParams["MODE"]);
// *************************/ADDITIONAL ****************************************************************
// *************************/Input params***************************************************************
$img["~src"] = $arParams["URL"];
$img["src_download"] = $arParams["URL"] . (strpos($arParams["URL"], '?') !== false ? '&' : '?') . "action=download";
$img["src"] = $arParams["URL"] . (strpos($arParams["URL"], '?') !== false ? '&' : '?') . ($arParams["MAX_SIZE"] !== null ? http_build_query($arParams["MAX_SIZE"]) : "");
// HTML size
$bNeedCreatePicture = false;
$props = ($img["width"] > 0 ? 'width="' . $img["width"] . '" ' : '') . ($img["height"] > 0 ? 'height="' . $img["height"] . '" ' : '');
if ($arParams["HTML_SIZE"] !== null) {
    if ($arParams["HTML_SIZE"]["width"] > 0 && $arParams["HTML_SIZE"]["height"] > 0 && $img["width"] > 0 && $img["height"] > 0) {
        CFile::ScaleImage($img["width"], $img["height"], $arParams["HTML_SIZE"], BX_RESIZE_IMAGE_PROPORTIONAL, $bNeedCreatePicture, $arSourceSize, $arDestinationSize);
        if ($bNeedCreatePicture) {
            $props = 'width="' . $arDestinationSize["width"] . '" height="' . $arDestinationSize["height"] . '" ';
        }
    } else {
        $style = array();
        if ($arParams["HTML_SIZE"]["width"] > 0) {
            $style[] = 'max-width:' . $arParams["HTML_SIZE"]["width"] . 'px;';
        }
        if ($arParams["HTML_SIZE"]["height"] > 0) {
            $style[] = 'max-height:' . $arParams["HTML_SIZE"]["height"] . 'px;';
        }
        if (!empty($style)) {
            $props = 'style="' . implode($style, "") . '"';
        }
    }
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:template.php

示例5: intval

<?php

require $_SERVER["DOCUMENT_ROOT"] . "/mobile/headers.php";
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/header.php";
$width = intval($_REQUEST["width"]);
$height = intval($_REQUEST["height"]);
$fid = intval($_REQUEST["fid"]);
$bfid = intval($_REQUEST["bfid"]);
if ($fid > 0) {
    $db_img_arr = CFile::GetFileArray($fid);
    if ($db_img_arr) {
        CFile::ScaleImage($db_img_arr["WIDTH"], $db_img_arr["HEIGHT"], array("width" => $width, "height" => $height), BX_RESIZE_IMAGE_PROPORTIONAL, $bNeedCreatePicture, $arSourceSize, $arDestinationSize);
        ?>
<img width="<?php 
        echo intval($arDestinationSize["width"] / 2);
        ?>
" height="<?php 
        echo intval($arDestinationSize["height"] / 2);
        ?>
" src="/bitrix/components/bitrix/blog/show_file.php?fid=<?php 
        echo $bfid;
        ?>
&width=<?php 
        echo $width;
        ?>
&height=<?php 
        echo $height;
        ?>
" alt="" title=""><?php 
    }
}
开发者ID:Levan1209,项目名称:u136016,代码行数:31,代码来源:blog_image.php

示例6: ResizeImageFile

	function ResizeImageFile($sourceFile, &$destinationFile, $arSize, $resizeType = BX_RESIZE_IMAGE_PROPORTIONAL, $arWaterMark = array(), $jpgQuality=false, $arFilters=false)
	{
		$io = CBXVirtualIo::GetInstance();

		$bNeedCreatePicture = false;

		if ($resizeType != BX_RESIZE_IMAGE_EXACT && $resizeType != BX_RESIZE_IMAGE_PROPORTIONAL_ALT)
			$resizeType = BX_RESIZE_IMAGE_PROPORTIONAL;

		if (!is_array($arSize))
			$arSize = array();
		if (!array_key_exists("width", $arSize) || intval($arSize["width"]) <= 0)
			$arSize["width"] = 0;
		if (!array_key_exists("height", $arSize) || intval($arSize["height"]) <= 0)
			$arSize["height"] = 0;
		$arSize["width"] = intval($arSize["width"]);
		$arSize["height"] = intval($arSize["height"]);

		$arSourceSize = array("x" => 0, "y" => 0, "width" => 0, "height" => 0);
		$arDestinationSize = array("x" => 0, "y" => 0, "width" => 0, "height" => 0);

		$arSourceFileSizeTmp = CFile::GetImageSize($sourceFile);
		if (!in_array($arSourceFileSizeTmp[2], array(IMAGETYPE_PNG, IMAGETYPE_JPEG, IMAGETYPE_GIF, IMAGETYPE_BMP)))
			return false;

		if (!$io->FileExists($sourceFile))
			return false;

		if ($io->Copy($sourceFile, $destinationFile))
		{
			switch ($arSourceFileSizeTmp[2])
			{
				case IMAGETYPE_GIF:
					$sourceImage = imagecreatefromgif($io->GetPhysicalName($sourceFile));
					$bHasAlpha = true;
					break;
				case IMAGETYPE_PNG:
					$sourceImage = imagecreatefrompng($io->GetPhysicalName($sourceFile));
					$bHasAlpha = true;
					break;
				case IMAGETYPE_BMP:
					$sourceImage = CFile::ImageCreateFromBMP($sourceFile);
					$bHasAlpha = false;
					break;
				default:
					$sourceImage = imagecreatefromjpeg($io->GetPhysicalName($sourceFile));
					$bHasAlpha = false;
					break;
			}

			$sourceImageWidth = intval(imagesx($sourceImage));
			$sourceImageHeight = intval(imagesy($sourceImage));

			if ($sourceImageWidth > 0 && $sourceImageHeight > 0)
			{
				if ($arSize["width"] <= 0 || $arSize["height"] <= 0)
				{
					$arSize["width"] = $sourceImageWidth;
					$arSize["height"] = $sourceImageHeight;
				}

				CFile::ScaleImage($sourceImageWidth, $sourceImageHeight, $arSize, $resizeType, $bNeedCreatePicture, $arSourceSize, $arDestinationSize);

				if ($bNeedCreatePicture)
				{
					if (CFile::IsGD2())
					{
						$picture = ImageCreateTrueColor($arDestinationSize["width"], $arDestinationSize["height"]);
						if($arSourceFileSizeTmp[2] == IMAGETYPE_PNG)
						{
							$transparentcolor = imagecolorallocatealpha($picture, 0, 0, 0, 127);
							imagefilledrectangle($picture, 0, 0, $arDestinationSize["width"], $arDestinationSize["height"], $transparentcolor);

							imagealphablending($picture, false);
							imagecopyresampled($picture, $sourceImage,
								0, 0, $arSourceSize["x"], $arSourceSize["y"],
								$arDestinationSize["width"], $arDestinationSize["height"], $arSourceSize["width"], $arSourceSize["height"]);
							imagealphablending($picture, true);
						}
						elseif($arSourceFileSizeTmp[2] == IMAGETYPE_GIF)
						{
							imagepalettecopy($picture, $sourceImage);

							//Save transparency for GIFs
							$transparentcolor = imagecolortransparent($sourceImage);
							if($transparentcolor >= 0 && $transparentcolor < imagecolorstotal($sourceImage))
							{
								$RGB = imagecolorsforindex($sourceImage, $transparentcolor);
								$transparentcolor = imagecolorallocate($picture, $RGB["red"], $RGB["green"], $RGB["blue"]);
								imagecolortransparent($picture, $transparentcolor);
								imagefilledrectangle($picture, 0, 0, $arDestinationSize["width"], $arDestinationSize["height"], $transparentcolor);
							}

							imagecopyresampled($picture, $sourceImage,
								0, 0, $arSourceSize["x"], $arSourceSize["y"],
								$arDestinationSize["width"], $arDestinationSize["height"], $arSourceSize["width"], $arSourceSize["height"]);
						}
						else
						{
							imagecopyresampled($picture, $sourceImage,
//.........这里部分代码省略.........
开发者ID:nProfessor,项目名称:Mytb,代码行数:101,代码来源:file.php

示例7: convert_blog_image


//.........这里部分代码省略.........
							$arFileTmp = CFile::ResizeImageGet(
								$db_img_arr,
								array("width" => $this->imageWidth, "height" => $this->imageHeight),
								BX_RESIZE_IMAGE_PROPORTIONAL,
								true
							);
							if(substr($arFileTmp["src"], 0, 1) == "/")
								$strImage = $this->serverName.$arFileTmp["src"];
							else
								$strImage = $arFileTmp["src"];
							$width = $arFileTmp["width"];
							$height = $arFileTmp["height"];
						}

						$strPar = ' width="'.$width.'" height="'.$height.'"';
						$strImage = preg_replace("'(?<!:)/+'s", "/", $strImage);
						$sourceImage = preg_replace("'(?<!:)/+'s", "/", $sourceImage);

						if(strlen($this->authorName) > 0)
							$strPar .= " data-bx-title=\"".$this->authorName."\"";

						if ($this->isSonetLog)
						{
							$strImage = preg_replace("'(?<!:)/+'s", "/", $strImage);
							$res = '[IMG]'.$strImage.'[/IMG]';
						}
						else
						{

							if($type == "mail")
								$res = htmlspecialcharsbx($f["TITLE"])." (IMAGE: ".$strImage." )";
							else
								$res = '<img src="'.$strImage.'" title="" alt="'.htmlspecialcharsbx($f["TITLE"]).'" border="0"'.$strPar.' data-bx-image="'.$sourceImage.'" />';
						}
					}
				}
				else
				{
					preg_match("/width\=([0-9]+)/is".BX_UTF_PCRE_MODIFIER, $p1, $width);
					preg_match("/height\=([0-9]+)/is".BX_UTF_PCRE_MODIFIER, $p1, $height);
					$width = intval($width[1]);
					$height = intval($height[1]);

					if($width <= 0)
					{
						preg_match("/width\=([0-9]+)/is".BX_UTF_PCRE_MODIFIER, $p2, $width);
						$width = intval($width[1]);
					}
					if($height <= 0)
					{
						preg_match("/height\=([0-9]+)/is".BX_UTF_PCRE_MODIFIER, $p2, $height);
						$height = intval($height[1]);
					}

					if(IntVal($width) <= 0)
						$width = $this->imageWidth;
					if(IntVal($height) <= 0)
						$height = $this->imageHeight;

					if($width > $this->imageWidth)
						$width = $this->imageWidth;
					if($height > $this->imageHeight)
						$height = $this->imageHeight;

					$strImage = $this->serverName."/bitrix/components/bitrix/blog/show_file.php?fid=".$imageId."&width=".$width."&height=".$height;
					$sourceImage = $this->serverName."/bitrix/components/bitrix/blog/show_file.php?fid=".$imageId;

					$db_img_arr = CFile::GetFileArray($this->arImages[$imageId]);

					CFile::ScaleImage($db_img_arr["WIDTH"], $db_img_arr["HEIGHT"], Array("width" => $width, "height" => $height), BX_RESIZE_IMAGE_PROPORTIONAL, $bNeedCreatePicture, $arSourceSize, $arDestinationSize);

					if ($this->isSonetLog)
					{
						$strImage = preg_replace("'(?<!:)/+'s", "/", $strImage);
						$res = '[IMG]'.$strImage.'[/IMG]';
					}
					else
					{
						if($type == "mail")
							$res = htmlspecialcharsbx($f["TITLE"])." (IMAGE: ".$strImage." )";
						else
						{
							$strPar = ' width="'.$arDestinationSize["width"].'" height="'.$arDestinationSize["height"].'"';
							if(strlen($this->authorName) > 0)
								$strPar .= " data-bx-title=\"".$this->authorName."\"";

							$res = '<img src="'.$strImage.'" title="" alt="'.htmlspecialcharsbx($f["TITLE"]).'" border="0" data-bx-image="'.$sourceImage.'"'.$strPar.' />';
							if(!empty($this->blogImageSizeEvents))
							{
								foreach($this->blogImageSizeEvents as $arEvent)
									ExecuteModuleEventEx($arEvent, Array(&$res, $strImage, $db_img_arr, $f, $arDestinationSize));
							}
						}
					}
				}
				return $res;
			}
		}
		return $res;
	}
开发者ID:ASDAFF,项目名称:entask.ru,代码行数:101,代码来源:functions.php

示例8: max

                 $circumscribed = $circumscribed1;
             }
         }
         if ($bExactly && $circumscribed) {
             CFile::ScaleImage($arSize["width"], $arSize["height"], $circumscribed, BX_RESIZE_IMAGE_PROPORTIONAL, $bNeedCreatePicture, $arSourceSize, $arSize);
         }
         $file["INLINE"]["width"] = $bExactly ? $arSize["width"] : $arDestinationSize["width"];
         $file["INLINE"]["height"] = $bExactly ? $arSize["height"] : $arDestinationSize["height"];
         // gallery
         $max_real_dimension = max(array(intval($file["IMAGE"]["WIDTH"]), intval($file["IMAGE"]["HEIGHT"])));
         if ($max_real_dimension > $max_dimension) {
             $arParams["SCREEN_SIZE"] = array("width" => $max_dimension, "height" => $max_dimension);
         } else {
             $arParams["SCREEN_SIZE"] = array("width" => $max_real_dimension, "height" => $max_real_dimension);
         }
         CFile::ScaleImage($file["IMAGE"]["WIDTH"], $file["IMAGE"]["HEIGHT"], $arParams["SCREEN_SIZE"], BX_RESIZE_IMAGE_PROPORTIONAL, $bNeedCreatePicture, $arSourceSize, $arDestinationSize);
         if ($bNeedCreatePicture) {
             $arParams["SCREEN_SIZE"]["signature"] = \Bitrix\Disk\Security\ParameterSigner::getImageSignature($file["ID"], $arParams["SCREEN_SIZE"]["width"], $arParams["SCREEN_SIZE"]["height"]);
             $file["BASIC"]["src"] .= "&" . http_build_query($arParams["SCREEN_SIZE"]);
             $file["BASIC"]["width"] = $arDestinationSize["width"];
             $file["BASIC"]["height"] = $arDestinationSize["height"];
         }
         $arResult["FILES"][$id] = $images[$id] = $file;
     } else {
         $arResult["FILES"][$id] = $files[$id] = $file;
     }
 }
 if ($this->__page == "show") {
     $arResult['IMAGES'] = $images;
     $arResult['FILES'] = $files;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:result_modifier.php

示例9: trim

$arParams["MODE"] = trim($arParams["MODE"]);
// *************************/ADDITIONAL ****************************************************************
// *************************/Input params***************************************************************
$img = array("~src" => $arParams["URL"], "src_download" => $arParams["URL"] . (strpos($arParams["URL"], '?') !== false ? '&' : '?') . "force_download=1", "src" => $arParams["URL"] . (strpos($arParams["URL"], '?') !== false ? '&' : '?') . http_build_query($arParams["MAX_SIZE"]), "~width" => $arParams["IMG_WIDTH"], "width" => $arParams["IMG_WIDTH"], "~height" => $arParams["IMG_HEIGHT"], "height" => $arParams["IMG_HEIGHT"]);
CFile::ScaleImage($arParams["IMG_WIDTH"], $arParams["IMG_HEIGHT"], $arParams["MAX_SIZE"], BX_RESIZE_IMAGE_PROPORTIONAL, $bNeedCreatePicture, $arSourceSize, $arDestinationSize);
$circumscribed = $arParams["MAX_SIZE"];
if ($arParams["HTML_SIZE"]) {
    CFile::ScaleImage($arParams["IMG_WIDTH"], $arParams["IMG_HEIGHT"], $arParams["HTML_SIZE"], BX_RESIZE_IMAGE_PROPORTIONAL, $bNeedCreatePicture1, $arSourceSize, $arDestinationSize1);
    if ($bNeedCreatePicture1 && ($arDestinationSize1["width"] < $arDestinationSize["width"] || $arDestinationSize1["height"] < $arDestinationSize["height"])) {
        $bNeedCreatePicture = true;
        $circumscribed = $arParams["HTML_SIZE"];
        $arDestinationSize = $arDestinationSize1;
    }
}
if ($bExactly) {
    CFile::ScaleImage($arParams["SIZE"]["width"], $arParams["SIZE"]["height"], $circumscribed, BX_RESIZE_IMAGE_PROPORTIONAL, $bNeedCreatePicture1, $arSourceSize, $arDestinationSize1);
    if ($bNeedCreatePicture1) {
        $bNeedCreatePicture = true;
        $arDestinationSize = $arDestinationSize1;
    }
}
if ($bNeedCreatePicture) {
    $img["width"] = $arDestinationSize["width"];
    $img["height"] = $arDestinationSize["height"];
}
if ($arParams['MODE'] == 'RSS') {
    ob_start();
    if (!$bNeedCreatePicture) {
        ?>
<img src="<?php 
        echo $img["src"];
开发者ID:spas-viktor,项目名称:books,代码行数:31,代码来源:template.php


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