Documentation

ShowImage

string
 CFile::ShowImage(
 mixed image,
 int MaxW = 0,
 int MaxH = 0,
 string Params = "border=0",
 string ImageUrl = "",
 bool popup = false,
 string PopupTitle = false,
 int SizeWHTTP = 0,
 int iSizeHHTTP = 0,
 string ImageUrlTemplate=""
)

The method returns HTML code that can be used to display an image file. Static method.

Parameters

ParameterDescription Available fr om version
imageThe 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.
MaxWMaximum image width. If the real width is larger than max_width, it will be proportionally scaled.
Optional parameter. The default value is "null", no applied restrictions.
MaxH Maximum image height. If the real width is larger than max_height, it will be proportionally scaled.
Optional parameter. The default value is "0", no applied restrictions.
If MaxW set as "0", the MaxH will not be factored in. To lim it height, the maximum width can be set as a larger value (for example, 9999) instead of "null".
ParamsArbitrary HTML code to be added to the IMG tag of the smaller image:
<img image_params ...>
Optional parameter. The default value is "null". If the alt="text" attribute is passed in this parameter, the <img> tag will use this value (from version 8.5.1). Otherwise, if the image has description in the 'b_file' table, this description will be used for the 'alt' attribute.
ImageUrlLink to open upon click on the image.
Optional parameter. The default value is "", which means do not display link.
popupSpecifies to open an additional popup window with enlarged image upon clicking.
Optional parameter. The default value is "false".
PopupTitle Text of the image tooltip (only if popup = true)
Optional parameter. The default text is "Click to enlarge" in the page language.
SizeWHTTP Image width, in pixels. Meaningful if only the image parameter specifies URL beginning with "http://")
Optional parameter. The default value is "0".
SizeHHTTPImage height, in pixels. (only if the image parameter specifies URL beginning with "http://")
Optional parameter. The default value is "0".
ImageUrlTemplate

See Also

Examples of use

<tr valign="top">
    <td align="right"><font class="tablefieldtext"><?echo 
	GetMessage("VOTE_IMAGE")?></font></td>
    <td><font class="tablebodytext"><?
    echo CFile::InputFile("IMAGE_ID", 20, $str_IMAGE_ID);
    if (strlen($str_IMAGE_ID)>0):
        ?><br><?
        echo CFile::ShowImage($str_IMAGE_ID, 200, 200, "border=0", "", true);
    endif;
    ?></font>
    </td>
</tr>


© «Bitrix24», 2001-2024