Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
image.php
1
<?php
2
3
namespace
Bitrix\Main\UI\Viewer\Renderer
;
4
5
use
Bitrix\Main\Engine\Response\ResizedImage
;
6
7
class
Image
extends
Renderer
8
{
9
const
WIDTH
= 1920;
10
const
HEIGHT
= 1080;
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
getOriginalImage
()
25
{
26
return
$this->
getOption
(
'originalImage'
);
27
}
28
29
public
static
function
getJsType
()
30
{
31
return
self::JS_TYPE_IMAGE
;
32
}
33
34
public
static
function
getAllowedContentTypes
()
35
{
36
return
[
37
'image/gif'
,
38
'image/jpeg'
,
39
'image/webp'
,
40
'image/bmp'
,
41
'image/png'
,
42
];
43
}
44
45
public
function
render
()
46
{
47
$imageFile = $this->
getOriginalImage
();
48
if
(!$imageFile)
49
{
50
return
null
;
51
}
52
53
$resizedImage =
new
ResizedImage
($imageFile, $this->
getWidth
(), $this->
getHeight
());
54
$resizedImage->setResizeType(BX_RESIZE_IMAGE_PROPORTIONAL);
55
56
return
$resizedImage;
57
}
58
}
Bitrix\Main\Engine\Response\ResizedImage
Definition
resizedimage.php:9
Bitrix\Main\UI\Viewer\Renderer\Image
Definition
image.php:8
Bitrix\Main\UI\Viewer\Renderer\Image\HEIGHT
const HEIGHT
Definition
image.php:10
Bitrix\Main\UI\Viewer\Renderer\Image\getAllowedContentTypes
static getAllowedContentTypes()
Definition
image.php:34
Bitrix\Main\UI\Viewer\Renderer\Image\WIDTH
const WIDTH
Definition
image.php:9
Bitrix\Main\UI\Viewer\Renderer\Image\getJsType
static getJsType()
Definition
image.php:29
Bitrix\Main\UI\Viewer\Renderer\Image\getOriginalImage
getOriginalImage()
Definition
image.php:24
Bitrix\Main\UI\Viewer\Renderer\Image\getHeight
getHeight()
Definition
image.php:19
Bitrix\Main\UI\Viewer\Renderer\Image\JS_TYPE_IMAGE
const JS_TYPE_IMAGE
Definition
image.php:12
Bitrix\Main\UI\Viewer\Renderer\Image\getWidth
getWidth()
Definition
image.php:14
Bitrix\Main\UI\Viewer\Renderer\Image\render
render()
Definition
image.php:45
Bitrix\Main\UI\Viewer\Renderer\Renderer
Definition
renderer.php:9
Bitrix\Main\UI\Viewer\Renderer\Renderer\getOption
getOption($name, $defaultValue=null)
Definition
renderer.php:25
Bitrix\Main\UI\Viewer\Renderer
Definition
audio.php:3
modules
main
lib
ui
viewer
renderer
image.php
Создано системой
1.10.0