Documentation

Show2Images

string
CFile::Show2Images(
 mixed image1,
 mixed image2,
 int max_width = 0,
 int max_height = 0,
 string image_params = "false",
 string popup_alt = false,
 int image_width = 0,
 int image_height = 0
)

The method returns the HTML code used to display a smaller image with a link which opens a separate popup window with a larger image. Static method.

Parameters

..
ParameterDescription
image1 The ID or path to the file within the current site, or URL to an external file on other server. If this parameter specified path to a file within the current site, it must be defined relative to the root. This parameters specifies the smaller image.
image2 The ID or path to the file within the current site, or URL to an external file on other server. If this parameter specified path to a file within the current site, it must be defined relative to the root. This parameters specifies the larger image displayed in a popup window.
max_widthMaximum width of the smaller image. If the real width is larger than max_width, max_width, it will be proportionally scaled.
Optional parameter. By default value is - "0", no applied restrictions.
max_height Maximum height of the smaller image. If the real height is larger than max_height, it will be proportionally scaled.
Optional parameter. By default value is - "0", no applied restrictions.
image_params Arbitrary HTML code to be added to the IMG tag of the smaller image:
<img image_params ...>
Optional parameter. Default value is "false".
popup_alt Text of the image tooltip.
Optional. The default text is "Click to enlarge" in the page language.
image_width Image width, in pixels. Meaningful only the image parameters specifies URL beginning with "http://")
Optional. The default value is "0".
image_height Image height, in pixels. Meaningful only if the image parameters specifies URL beginning with "http://")
Optional. The default value is "0".

See Also

Examples of use

<?
if ($rsElements = GetIBlockElementListEx($IBLOCK_TYPE, $IBLOCK_ID, false, array($ELEMENT_SORT_FIELD => $ELEMENT_SORT_ORDER, "ID" => "ASC"), false, $arrFilter)):
    $rsElements->NavStart($PAGE_ELEMENT_COUNT);
	while ($obElement = $rsElements->GetNextElement()):
		$arElement = $obElement->GetFields();
		$image1 = intval($arElement["PREVIEW_PICTURE"])<=0 ? $arElement["DETAIL_PICTURE"] : $arElement["PREVIEW_PICTURE"];
		$image2 = intval($arElement["DETAIL_PICTURE"])<=0 ? $arElement["PREVIEW_PICTURE"] : $arElement["DETAIL_PICTURE"];
		echo CFile::Show2Images($image1, $image2, 150, 150, "hspace='0' vspace='0' border='0' title='".$arElement["NAME"]."'", true);
	endwhile;
endif;
?>


© «Bitrix24», 2001-2024