1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
image.php
См. документацию.
1<?php
2
3namespace Bitrix\Main\UI\Viewer\Renderer;
4
5use Bitrix\Main\Engine\Response\ResizedImage;
6
7class Image extends Renderer
8{
9 const WIDTH = 1920;
10 const HEIGHT = 1920;
11
12 const JS_TYPE_IMAGE = 'image';
13
14 public function getWidth()
15 {
16 return $this->getOption('width', self::WIDTH);
17 }
18
19 public function getHeight()
20 {
21 return $this->getOption('height', self::HEIGHT);
22 }
23
24 public function getResizeType()
25 {
27 }
28
29 public function getOriginalImage()
30 {
31 return $this->getOption('originalImage');
32 }
33
34 public static function getJsType()
35 {
36 return self::JS_TYPE_IMAGE;
37 }
38
39 public static function getAllowedContentTypes()
40 {
41 return [
42 'image/gif',
43 'image/jpeg',
44 'image/webp',
45 'image/bmp',
46 'image/png',
47 ];
48 }
49
50 public function render()
51 {
52 $imageFile = $this->getOriginalImage();
53 if (!$imageFile)
54 {
55 return null;
56 }
57
58 $resizedImage = new ResizedImage($imageFile, $this->getWidth(), $this->getHeight());
59 $resizedImage->setResizeType($this->getResizeType());
60
61 return $resizedImage;
62 }
63}
static getAllowedContentTypes()
Определения image.php:39
static getJsType()
Определения image.php:34
const JS_TYPE_IMAGE
Определения image.php:12
getOption($name, $defaultValue=null)
Определения renderer.php:25
const BX_RESIZE_IMAGE_PROPORTIONAL
Определения constants.php:11