Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
resizedimage.php
1
<?php
2
3
namespace
Bitrix\Main\Engine\Response
;
4
5
6
use
Bitrix\Main
;
7
8
class
ResizedImage
extends
BFile
9
{
10
protected
$showInline
=
true
;
11
protected
$width
;
12
protected
$height
;
13
protected
$resizeType
= BX_RESIZE_IMAGE_EXACT;
14
protected
$filters
;
15
16
public
function
__construct
(array
$file
,
$width
,
$height
,
$name
=
null
)
17
{
18
parent::__construct(
$file
,
$name
);
19
20
$this->
setWidth
(
$width
);
21
$this->
setHeight
(
$height
);
22
}
23
24
public
static
function
createByImageId
($imageId,
$width
,
$height
,
$name
=
null
)
25
{
26
$imageData = \CFile::getFileArray($imageId);
27
if
(!$imageData)
28
{
29
throw
new
Main\ObjectNotFoundException
(
"Could not find file"
);
30
}
31
32
return
new
self
($imageData,
$width
,
$height
,
$name
);
33
}
34
35
public
static
function
createByImageData
(array $imageData,
$width
,
$height
,
$name
=
null
)
36
{
37
return
new
self
($imageData,
$width
,
$height
,
$name
);
38
}
39
43
public
function
getWidth
()
44
{
45
return
$this->width
;
46
}
47
53
public
function
setWidth
(
$width
)
54
{
55
$this->width =
$width
;
56
57
return
$this;
58
}
59
63
public
function
getHeight
()
64
{
65
return
$this->height
;
66
}
67
73
public
function
setHeight
(
$height
)
74
{
75
$this->height =
$height
;
76
77
return
$this;
78
}
79
83
public
function
getResizeType
()
84
{
85
return
$this->resizeType
;
86
}
87
93
public
function
setResizeType
(
$resizeType
)
94
{
95
$this->resizeType =
$resizeType
;
96
97
return
$this;
98
}
99
103
public
function
getFilters
()
104
{
105
return
$this->filters
;
106
}
107
113
public
function
setFilters
(
$filters
)
114
{
115
$this->filters =
$filters
;
116
117
return
$this;
118
}
119
123
public
function
getImage
()
124
{
125
return
$this->file
;
126
}
127
128
protected
function
prepareFile
()
129
{
130
$file
= parent::prepareFile();
131
132
$tmpFile = \CFile::resizeImageGet(
133
$file
,
134
[
'width'
=> $this->
getWidth
(),
'height'
=> $this->
getHeight
()],
135
$this->
getResizeType
(),
136
true
,
137
$this->
getFilters
(),
138
true
139
);
140
141
$file
[
'FILE_SIZE'
] = $tmpFile[
'size'
];
142
$file
[
'SRC'
] = $tmpFile[
'src'
];
143
144
return
$file
;
145
}
146
}
Bitrix\Main\Engine\Response\BFile
Definition
bfile.php:9
Bitrix\Main\Engine\Response\BFile\$file
$file
Definition
bfile.php:10
Bitrix\Main\Engine\Response\File\$name
$name
Definition
file.php:14
Bitrix\Main\Engine\Response\ResizedImage
Definition
resizedimage.php:9
Bitrix\Main\Engine\Response\ResizedImage\$showInline
$showInline
Definition
resizedimage.php:10
Bitrix\Main\Engine\Response\ResizedImage\getImage
getImage()
Definition
resizedimage.php:123
Bitrix\Main\Engine\Response\ResizedImage\prepareFile
prepareFile()
Definition
resizedimage.php:128
Bitrix\Main\Engine\Response\ResizedImage\__construct
__construct(array $file, $width, $height, $name=null)
Definition
resizedimage.php:16
Bitrix\Main\Engine\Response\ResizedImage\$height
$height
Definition
resizedimage.php:12
Bitrix\Main\Engine\Response\ResizedImage\setHeight
setHeight($height)
Definition
resizedimage.php:73
Bitrix\Main\Engine\Response\ResizedImage\getFilters
getFilters()
Definition
resizedimage.php:103
Bitrix\Main\Engine\Response\ResizedImage\$width
$width
Definition
resizedimage.php:11
Bitrix\Main\Engine\Response\ResizedImage\getResizeType
getResizeType()
Definition
resizedimage.php:83
Bitrix\Main\Engine\Response\ResizedImage\$resizeType
$resizeType
Definition
resizedimage.php:13
Bitrix\Main\Engine\Response\ResizedImage\setResizeType
setResizeType($resizeType)
Definition
resizedimage.php:93
Bitrix\Main\Engine\Response\ResizedImage\createByImageId
static createByImageId($imageId, $width, $height, $name=null)
Definition
resizedimage.php:24
Bitrix\Main\Engine\Response\ResizedImage\createByImageData
static createByImageData(array $imageData, $width, $height, $name=null)
Definition
resizedimage.php:35
Bitrix\Main\Engine\Response\ResizedImage\getHeight
getHeight()
Definition
resizedimage.php:63
Bitrix\Main\Engine\Response\ResizedImage\setWidth
setWidth($width)
Definition
resizedimage.php:53
Bitrix\Main\Engine\Response\ResizedImage\$filters
$filters
Definition
resizedimage.php:14
Bitrix\Main\Engine\Response\ResizedImage\setFilters
setFilters($filters)
Definition
resizedimage.php:113
Bitrix\Main\Engine\Response\ResizedImage\getWidth
getWidth()
Definition
resizedimage.php:43
Bitrix\Main\ObjectNotFoundException
Definition
exception.php:203
Bitrix\Main\Engine\Response
Definition
ajaxjson.php:3
Bitrix\Main
modules
main
lib
engine
response
resizedimage.php
Создано системой
1.10.0