// Resize an image to 200px x 300px CFile::ResizeImageFile( $sourceFile, // path to the source file $destinationFile, // path to the destination file array( "width" => 200, "height" => 300, "resize_type" => BX_RESIZE_IMAGE_PROPORTIONAL, ), BX_RESIZE_IMAGE_EXACT );
// Resize an image and add a watermark CFile::ResizeImageFile( $sourceFile, $destinationFile, array( "width" => 400, "height" => 400, "resize_type" => BX_RESIZE_IMAGE_PROPORTIONAL, "watermark" => array( "file" => $watermarkFile, // path to the watermark file "position" => "center", // position of the watermark ) ), BX_RESIZE_IMAGE_PROPORTIONAL );This code resizes an image while also adding a watermark positioned at the center of the image. The watermark file is located at `$watermarkFile`. The `BX_RESIZE_IMAGE_PROPORTIONAL` parameter is used for both the resize type and watermark mode to ensure that the image is proportional and that the watermark is not too large. The `CFile` class is part of the Bitrix CMS framework.