reference/image/functions/getimagesize.xml
d0532e45fb2b6766c7fc73c7ccfc30a9720f8888
...
...
@@ -8,21 +8,34 @@
8
8
<refsect1 role="description">
9
9
&reftitle.description;
10
10
<methodsynopsis>
11
-
<type>array</type><methodname>getimagesize</methodname>
11
+
<type class="union"><type>array</type><type>false</type></type><methodname>getimagesize</methodname>
12
12
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
13
-
<methodparam choice="opt"><type>array</type><parameter role="reference">imageinfo</parameter></methodparam>
13
+
<methodparam choice="opt"><type>array</type><parameter role="reference">image_info</parameter><initializer>&null;</initializer></methodparam>
14
14
</methodsynopsis>
15
15
<para>
16
16
The <function>getimagesize</function> function will determine the
17
-
size of any given image file and return the dimensions along with
17
+
size of any supported given image file and return the dimensions along with
18
18
the file type and a <literal>height/width</literal> text string to be used inside a
19
19
normal <acronym>HTML</acronym> <tag>IMG</tag> tag and the
20
-
correspondant <acronym>HTTP</acronym> content type.
20
+
correspondent <acronym>HTTP</acronym> content type.
21
21
</para>
22
22
<para>
23
23
<function>getimagesize</function> can also return some more information
24
-
in <parameter>imageinfo</parameter> parameter.
24
+
in <parameter>image_info</parameter> parameter.
25
25
</para>
26
+
<caution>
27
+
<para>
28
+
This function expects <parameter>filename</parameter> to be a valid
29
+
image file. If a non-image file is supplied, it may be incorrectly
30
+
detected as an image and the function will return successfully, but
31
+
the array may contain nonsensical values.
32
+
</para>
33
+
<para>
34
+
Do not use <function>getimagesize</function> to check that a given
35
+
file is a valid image. Use a purpose-built solution such as the
36
+
<link linkend="book.fileinfo">Fileinfo</link> extension instead.
37
+
</para>
38
+
</caution>
26
39
<note>
27
40
<simpara>
28
41
Note that JPC and JP2 are capable of having components with different
...
...
@@ -38,6 +51,14 @@
38
51
bitrate.
39
52
</simpara>
40
53
</note>
54
+
<note>
55
+
<simpara>
56
+
GIF images consist of one or more frames, where each frame may only occupy
57
+
part of the image. The size of the image which is reported by
58
+
<function>getimagesize</function> is the overall size (read from the logical
59
+
screen descriptor).
60
+
</simpara>
61
+
</note>
41
62
</refsect1>
42
63
43
64
<refsect1 role="parameters">
...
...
@@ -50,12 +71,12 @@
50
71
<para>
51
72
This parameter specifies the file you wish to retrieve information
52
73
about. It can reference a local file or (configuration permitting) a
53
-
remote file using one of the supported streams.
74
+
remote file using one of the <link linkend="wrappers">supported streams</link>.
54
75
</para>
55
76
</listitem>
56
77
</varlistentry>
57
78
<varlistentry>
58
-
<term><parameter>imageinfo</parameter></term>
79
+
<term><parameter>image_info</parameter></term>
59
80
<listitem>
60
81
<para>
61
82
This optional parameter allows you to extract some extended
...
...
@@ -67,6 +88,12 @@
67
88
You can use the <function>iptcparse</function> function to parse the
68
89
binary APP13 marker into something readable.
69
90
</para>
91
+
<note>
92
+
<para>
93
+
The <parameter>image_info</parameter> only supports
94
+
<acronym>JFIF</acronym> files.
95
+
</para>
96
+
</note>
70
97
</listitem>
71
98
</varlistentry>
72
99
</variablelist>
...
...
@@ -76,7 +103,8 @@
76
103
<refsect1 role="returnvalues">
77
104
&reftitle.returnvalues;
78
105
<para>
79
-
Returns an array with 7 elements.
106
+
Returns an array with up to 7 elements. Not all image types will include
107
+
the <literal>channels</literal> and <literal>bits</literal> elements.
80
108
</para>
81
109
<para>
82
110
Index 0 and 1 contains respectively the width and the height of the image.
...
...
@@ -90,7 +118,7 @@
90
118
</para>
91
119
</note>
92
120
<para>
93
-
Index 2 is one of the <literal>IMAGETYPE_XXX</literal> constants indicating
121
+
Index 2 is one of the <link linkend="image.constants">IMAGETYPE_XXX constants</link> indicating
94
122
the type of the image.
95
123
</para>
96
124
<para>
...
...
@@ -143,9 +171,9 @@ if ($size && $fp) {
143
171
<refsect1 role="errors">
144
172
&reftitle.errors;
145
173
<para>
146
-
If accessing the <parameter>filename</parameter> image is impossible, or
147
-
if it isn't a valid picture, <function>getimagesize</function> will
148
-
generate an error of level <constant>E_WARNING</constant>. On read error,
174
+
If accessing the <parameter>filename</parameter> image is impossible
175
+
<function>getimagesize</function> will generate an error of level
176
+
<constant>E_WARNING</constant>. On read error,
149
177
<function>getimagesize</function> will generate an error of level
150
178
<constant>E_NOTICE</constant>.
151
179
</para>
...
...
@@ -164,70 +192,17 @@ if ($size && $fp) {
164
192
</thead>
165
193
<tbody>
166
194
<row>
167
-
<entry>5.3.0</entry>
195
+
<entry>8.2.0</entry>
168
196
<entry>
169
-
Added icon support.
197
+
Now returns the actual image dimensions, bits and channels of AVIF images;
198
+
previously, the dimensions were reported as <literal>0x0</literal>,
199
+
and bits and channels were not reported at all.
170
200
</entry>
171
201
</row>
172
202
<row>
173
-
<entry>5.2.3</entry>
203
+
<entry>7.1.0</entry>
174
204
<entry>
175
-
Read errors generated by this function downgraded to
176
-
<constant>E_NOTICE</constant> from <constant>E_WARNING</constant>.
177
-
</entry>
178
-
</row>
179
-
<row>
180
-
<entry>4.3.2</entry>
181
-
<entry>
182
-
Support for <acronym>JPC</acronym>, <acronym>JP2</acronym>,
183
-
<acronym>JPX</acronym>, <acronym>JB2</acronym>,
184
-
<acronym>XBM</acronym>, and <acronym>WBMP</acronym> became available.
185
-
</entry>
186
-
</row>
187
-
<row>
188
-
<entry>4.3.2</entry>
189
-
<entry>
190
-
JPEG 2000 support was added for the <parameter>imageinfo</parameter>
191
-
parameter.
192
-
</entry>
193
-
</row>
194
-
<row>
195
-
<entry>4.3.0</entry>
196
-
<entry>
197
-
<literal>bits</literal> and <literal>channels</literal> are present
198
-
for other image types, too.
199
-
</entry>
200
-
</row>
201
-
<row>
202
-
<entry>4.3.0</entry>
203
-
<entry>
204
-
<literal>mime</literal> was added.
205
-
</entry>
206
-
</row>
207
-
<row>
208
-
<entry>4.3.0</entry>
209
-
<entry>
210
-
Support for <acronym>SWC</acronym> and <acronym>IFF</acronym> was
211
-
added.
212
-
</entry>
213
-
</row>
214
-
<row>
215
-
<entry>4.2.0</entry>
216
-
<entry>
217
-
Support for <acronym>TIFF</acronym> was added.
218
-
</entry>
219
-
</row>
220
-
<row>
221
-
<entry>4.0.6</entry>
222
-
<entry>
223
-
Support for <acronym>BMP</acronym> and <acronym>PSD</acronym> was
224
-
added.
225
-
</entry>
226
-
</row>
227
-
<row>
228
-
<entry>4.0.5</entry>
229
-
<entry>
230
-
URL support was added.
205
+
Added WebP support.
231
206
</entry>
232
207
</row>
233
208
</tbody>
...
...
@@ -288,17 +263,16 @@ if (isset($info["APP13"])) {
288
263
289
264
<refsect1 role="seealso">
290
265
&reftitle.seealso;
291
-
<para>
292
-
<simplelist>
293
-
<member><function>image_type_to_mime_type</function></member>
294
-
<member><function>exif_imagetype</function></member>
295
-
<member><function>exif_read_data</function></member>
296
-
<member><function>exif_thumbnail</function></member>
297
-
</simplelist>
298
-
</para>
266
+
<simplelist>
267
+
<member><function>image_type_to_mime_type</function></member>
268
+
<member><function>exif_imagetype</function></member>
269
+
<member><function>exif_read_data</function></member>
270
+
<member><function>exif_thumbnail</function></member>
271
+
<member><function>imagesx</function></member>
272
+
<member><function>imagesy</function></member>
273
+
</simplelist>
299
274
</refsect1>
300
275
</refentry>
301
-

302
276
<!-- Keep this comment at the end of the file
303
277
Local variables:
304
278
mode: sgml
...
...
@@ -319,4 +293,3 @@ vim600: syn=xml fen fdm=syntax fdl=2 si
319
293
vim: et tw=78 syn=sgml
320
294
vi: ts=1 sw=1
321
295
-->
322
-

323
296