Documentation

InitImage

array
CSocNetTools::InitImage(
 int imageID,
 int imageSize,
 string defaultImage,
 int defaultImageSize,
 string imageUrl,
 string showImageUrl,
 string urlParams = false
);

The method returns image parameters, set by its ID. When required, image is resized. When image is missing, default image is returned. Non-static method.

Parameters

Parameter Description Available from version
imageID Image ID.
imageSize Image size. When at least one size measurement of the original image is larger than the specified size, resizing is performed automatically.
defaultImage Link to the image set as default. It is used, when the required image is not found.
defaultImageSize "Default" image size.
imageUrl Browser link when clicking on the image. May not be specified.
showImageUrl Flag with value as "true", when link must be displayed. Otherwise - false.
urlParams Additional parameters of the link (for the tag a).

Returned value

The method returns array with keys FILE and IMG. The FILE key contains an array describing the image (similar to the array, returned by the method CFile::GetFileArray). The key IMG contains a ready-to-print HTML string that displays the image.

Example

<?
$arImage = CSocNetTools::InitImage($personalPhoto, 150, "/bitrix/images/socialnetwork/nopic_user_150.gif", 150, "", false);
?>


© «Bitrix24», 2001-2024