Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
Info.php
1
<?php
9
namespace
Bitrix\Main\File\Image
;
10
11
use \Bitrix\Main\File\Image;
12
13
class
Info
14
{
15
protected
16
$width
,
17
$height
,
18
$format
,
19
$attributes
,
20
$mime
;
21
25
public
function
getWidth
()
26
{
27
return
$this->width
;
28
}
29
34
public
function
setWidth
(
$width
)
35
{
36
$this->width =
$width
;
37
return
$this;
38
}
39
43
public
function
getHeight
()
44
{
45
return
$this->height
;
46
}
47
52
public
function
setHeight
(
$height
)
53
{
54
$this->height =
$height
;
55
return
$this;
56
}
57
61
public
function
getFormat
()
62
{
63
return
$this->format
;
64
}
65
70
public
function
setFormat
(
$format
)
71
{
72
$this->format =
$format
;
73
return
$this;
74
}
75
79
public
function
getAttributes
()
80
{
81
return
"width=\"{$this->getWidth()}\" height=\"{$this->getHeight()}\""
;
82
}
83
87
public
function
getMime
()
88
{
89
return
$this->mime
;
90
}
91
96
public
function
setMime
(
$mime
)
97
{
98
$this->mime =
$mime
;
99
return
$this;
100
}
101
106
public
function
swapSides
()
107
{
108
$tmp = $this->
getHeight
();
109
$this->
setHeight
($this->
getWidth
())
110
->setWidth($tmp);
111
return
$this;
112
}
113
118
public
function
isSupported
()
119
{
120
static
$knownTypes =
null
;
121
122
if
($knownTypes ===
null
)
123
{
124
$knownTypes = [
125
Image::FORMAT_PNG
=> 1,
126
Image::FORMAT_JPEG
=> 1,
127
Image::FORMAT_GIF
=> 1,
128
Image::FORMAT_BMP
=> 1,
129
];
130
if
(function_exists(
"imagecreatefromwebp"
))
131
{
132
$knownTypes[
Image::FORMAT_WEBP
] = 1;
133
}
134
}
135
136
return
isset($knownTypes[$this->
getFormat
()]);
137
}
138
143
public
function
toRectangle
()
144
{
145
return
new
Rectangle
($this->
getWidth
(), $this->
getHeight
());
146
}
147
}
Bitrix\Main\File\Image\Info
Definition
Info.php:14
Bitrix\Main\File\Image\Info\setMime
setMime($mime)
Definition
Info.php:96
Bitrix\Main\File\Image\Info\$format
$format
Definition
Info.php:18
Bitrix\Main\File\Image\Info\$height
$height
Definition
Info.php:17
Bitrix\Main\File\Image\Info\isSupported
isSupported()
Definition
Info.php:118
Bitrix\Main\File\Image\Info\setHeight
setHeight($height)
Definition
Info.php:52
Bitrix\Main\File\Image\Info\swapSides
swapSides()
Definition
Info.php:106
Bitrix\Main\File\Image\Info\$width
$width
Definition
Info.php:16
Bitrix\Main\File\Image\Info\getMime
getMime()
Definition
Info.php:87
Bitrix\Main\File\Image\Info\$mime
$mime
Definition
Info.php:20
Bitrix\Main\File\Image\Info\getHeight
getHeight()
Definition
Info.php:43
Bitrix\Main\File\Image\Info\setFormat
setFormat($format)
Definition
Info.php:70
Bitrix\Main\File\Image\Info\toRectangle
toRectangle()
Definition
Info.php:143
Bitrix\Main\File\Image\Info\setWidth
setWidth($width)
Definition
Info.php:34
Bitrix\Main\File\Image\Info\$attributes
$attributes
Definition
Info.php:19
Bitrix\Main\File\Image\Info\getFormat
getFormat()
Definition
Info.php:61
Bitrix\Main\File\Image\Info\getWidth
getWidth()
Definition
Info.php:25
Bitrix\Main\File\Image\Info\getAttributes
getAttributes()
Definition
Info.php:79
Bitrix\Main\File\Image\Rectangle
Definition
Rectangle.php:14
Bitrix\Main\File\Image\FORMAT_JPEG
const FORMAT_JPEG
Definition
Image.php:17
Bitrix\Main\File\Image\FORMAT_WEBP
const FORMAT_WEBP
Definition
Image.php:20
Bitrix\Main\File\Image\FORMAT_GIF
const FORMAT_GIF
Definition
Image.php:18
Bitrix\Main\File\Image\FORMAT_BMP
const FORMAT_BMP
Definition
Image.php:19
Bitrix\Main\File\Image\FORMAT_PNG
const FORMAT_PNG
Definition
Image.php:16
Bitrix\Main\File\Image
Definition
Color.php:9
modules
main
lib
File
Image
Info.php
Создано системой
1.10.0