Bitrix Site Manager

CFile::Show2Images

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

The method Show2Images returns the HTML code used to display a smaller image with a link which opens a new window with a larger image.

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_width Maximum width of the smaller image. If the real width is larger than max_width, it will be proportionally scaled.

Optional. The default value is "0", which means no restriction applies.
max_height Maximum height of the smaller image. If the real height is larger than max_height, it will be proportionally scaled.

Optional. The default value is "0", which means no restriction applies.
image_params Arbitrary HTML code to be added to the IMG tag of the smaller image:
<img image_params ...>

Optional. The default value is "border=0".
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 if only the image parameters specifies URL beginning with "http://".

Optional. The default value is "0".
image_height Image height, in pixels. Meaningful if only the image parameters specifies URL beginning with "http://".

Optional. The default value is "0".

See Also

Example



<?
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;
?>