Bitrix Site Manager

CFile::ShowImage

string
CFile::ShowImage(
 mixed image,
 int max_width = 0,
 int max_height = 0,
 string image_params = "border=0",
 string url = "",
 bool popup = false,
 string popup_alt = false,
 int image_width = 0,
 int image_height = 0
)

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

Parameters

ParameterDescription
image 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.
max_width Maximum width of an 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 an 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".
url Link to open upon click on the image.

Optional. The default value is "", which means do not display link.
popup Specifies to open a new window upon click.

Optional. The default value is "false".
popup_alt Text of the image tooltip (if popup is true).

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



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