[doc-en] master: Document PHP 8.5 image changes (HEIF, SVG, units, Exif OffsetTime) (#5948)
| From: | Louis-Arnaud via GitHub | Date: | Wed, 18 Nov 2026 08:11:53 +0000 |
| Subject: | [doc-en] master: Document PHP 8.5 image changes (HEIF, SVG, units, Exif OffsetTime) (#5948) | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-23974@lists.php.net to get a copy of this message | ||
Author: Louis-Arnaud (lacatoire)
Committer: GitHub (web-flow)
Pusher: lacatoire
Date: 2026-11-18T09:11:50+01:00
Commit: https://github.com/php/doc-en/commit/4cab6e04096c02da7accd5668f9e5aaae2ac681b
Raw diff: https://github.com/php/doc-en/commit/4cab6e04096c02da7accd5668f9e5aaae2ac681b.diff
Document PHP 8.5 image changes (HEIF, SVG, units, Exif OffsetTime) (#5948)
getimagesize() gains HEIF/HEIC and SVG (libxml) support and the
width_unit/height_unit elements; image_type_to_extension() and
image_type_to_mime_type() handle IMAGETYPE_SVG; add IMAGETYPE_SVG;
exif_read_data() names the OffsetTime* tags.
Changed paths:
M reference/exif/functions/exif-read-data.xml
M reference/image/constants.xml
M reference/image/functions/getimagesize.xml
M reference/image/functions/image-type-to-extension.xml
M reference/image/functions/image-type-to-mime-type.xml
Diff:
diff --git a/reference/exif/functions/exif-read-data.xml
b/reference/exif/functions/exif-read-data.xml
index cedb2a22839a..b4c78382ddfe 100644
--- a/reference/exif/functions/exif-read-data.xml
+++ b/reference/exif/functions/exif-read-data.xml
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
-<!-- splitted from ./en/functions/image.xml, last change in rev 1.78 -->
-<refentry xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink"
xml:id="function.exif-read-data">
+<refentry xml:id="function.exif-read-data" xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>exif_read_data</refname>
<refpurpose>Reads the <acronym>EXIF</acronym> headers from an image
file</refpurpose>
@@ -186,6 +185,16 @@
</row>
</thead>
<tbody>
+ <row>
+ <entry>8.5.0</entry>
+ <entry>
+ The <literal>OffsetTime</literal>,
<literal>OffsetTimeOriginal</literal>
+ and <literal>OffsetTimeDigitized</literal> tags are now recognized;
+ previously they were reported as <literal>UndefinedTag:0x9010</literal>,
+ <literal>UndefinedTag:0x9011</literal> and
+ <literal>UndefinedTag:0x9012</literal>.
+ </entry>
+ </row>
<row>
<entry>8.0.0</entry>
<entry>
diff --git a/reference/image/constants.xml b/reference/image/constants.xml
index 2c220c056861..b4feb81383c1 100644
--- a/reference/image/constants.xml
+++ b/reference/image/constants.xml
@@ -713,6 +713,19 @@
</simpara>
</listitem>
</varlistentry>
+ <varlistentry xml:id="constant.imagetype-svg">
+ <term>
+ <constant>IMAGETYPE_SVG</constant>
+ (<type>int</type>)
+ </term>
+ <listitem>
+ &gd.constants.type;
+ <simpara>
+ (Available as of PHP 8.5.0, only if the
+ <link linkend="book.libxml">libxml</link> extension is loaded)
+ </simpara>
+ </listitem>
+ </varlistentry>
<varlistentry xml:id="constant.imagetype-unknown">
<term>
<constant>IMAGETYPE_UNKNOWN</constant>
diff --git a/reference/image/functions/getimagesize.xml b/reference/image/functions/getimagesize.xml
index 3060cda309b5..02cbd6a697a2 100644
--- a/reference/image/functions/getimagesize.xml
+++ b/reference/image/functions/getimagesize.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
-<refentry xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://docbook.org/ns/docbook"
xml:id="function.getimagesize">
+<refentry xml:id="function.getimagesize" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>getimagesize</refname>
<refpurpose>Get the size of an image</refpurpose>
@@ -45,6 +45,15 @@
codestream it encounters in the root of the file.
</simpara>
</note>
+ <note>
+ <simpara>
+ SVG images are only recognized if the <link
linkend="book.libxml">libxml</link>
+ extension is loaded. The root <tag>svg</tag> element must have
+ <literal>width</literal> and <literal>height</literal> attributes, each
an
+ integer optionally followed by a unit, such as <literal>5cm</literal>.
+ Otherwise, &false; is returned.
+ </simpara>
+ </note>
<note>
<simpara>
The information about icons are retrieved from the icon with the highest
@@ -102,10 +111,10 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
- <para>
- Returns an array with up to 7 elements. Not all image types will include
+ <simpara>
+ Returns an array with up to 9 elements. Not all image types will include
the <literal>channels</literal> and <literal>bits</literal> elements.
- </para>
+ </simpara>
<para>
Index 0 and 1 contains respectively the width and the height of the image.
</para>
@@ -129,11 +138,12 @@
Index 2 is one of the
<constant>IMAGETYPE_<replaceable>*</replaceable></constant> constants
indicating
the type of the image.
</para>
- <para>
+ <simpara>
Index 3 is a text string with the correct
<literal>height="yyy" width="xxx"</literal> string that can be
used
- directly in an <acronym>IMG</acronym> tag.
- </para>
+ directly in an <acronym>IMG</acronym> tag. It is omitted if the width or
+ the height is not expressed in pixels.
+ </simpara>
<para>
<literal>mime</literal> is the corresponding MIME type of the image.
This information can be used to deliver images with the correct HTTP
@@ -157,6 +167,12 @@ if ($size && $fp) {
</programlisting>
</example>
</para>
+ <simpara>
+ <literal>width_unit</literal> and <literal>height_unit</literal> are the
+ units in which index 0 and 1 are expressed. They are
<literal>"px"</literal>
+ unless the image states otherwise, as SVG images can, and they may differ
+ from each other.
+ </simpara>
<para>
<literal>channels</literal> will be 3 for RGB pictures and 4 for CMYK
pictures.
@@ -193,42 +209,59 @@ if ($size && $fp) {
<refsect1 role="changelog">
&reftitle.changelog;
- <para>
- <informaltable>
- <tgroup cols="2">
- <thead>
- <row>
- <entry>&Version;</entry>
- <entry>&Description;</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>8.2.0</entry>
- <entry>
- Now returns the actual image dimensions, bits and channels of AVIF images;
- previously, the dimensions were reported as <literal>0x0</literal>,
- and bits and channels were not reported at all.
- </entry>
- </row>
- <row>
- <entry>8.0.0</entry>
- <entry>
- A <exceptionname>ValueError</exceptionname> is now thrown if
- <parameter>filename</parameter> is empty; previously an
- <constant>E_WARNING</constant> was raised and the function returned
&false;.
- </entry>
- </row>
- <row>
- <entry>7.1.0</entry>
- <entry>
- Added WebP support.
- </entry>
- </row>
- </tbody>
- </tgroup>
- </informaltable>
- </para>
+ <informaltable>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>&Version;</entry>
+ <entry>&Description;</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>8.5.0</entry>
+ <entry>
+ Added support for HEIF/HEIC images.
+ </entry>
+ </row>
+ <row>
+ <entry>8.5.0</entry>
+ <entry>
+ Added support for SVG images, if the libxml extension is loaded.
+ </entry>
+ </row>
+ <row>
+ <entry>8.5.0</entry>
+ <entry>
+ The returned array now contains the <literal>width_unit</literal> and
+ <literal>height_unit</literal> elements.
+ </entry>
+ </row>
+ <row>
+ <entry>8.2.0</entry>
+ <entry>
+ Now returns the actual image dimensions, bits and channels of AVIF images;
+ previously, the dimensions were reported as <literal>0x0</literal>,
+ and bits and channels were not reported at all.
+ </entry>
+ </row>
+ <row>
+ <entry>8.0.0</entry>
+ <entry>
+ A <exceptionname>ValueError</exceptionname> is now thrown if
+ <parameter>filename</parameter> is empty; previously an
+ <constant>E_WARNING</constant> was raised and the function returned &false;.
+ </entry>
+ </row>
+ <row>
+ <entry>7.1.0</entry>
+ <entry>
+ Added WebP support.
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
</refsect1>
<refsect1 role="examples">
diff --git a/reference/image/functions/image-type-to-extension.xml
b/reference/image/functions/image-type-to-extension.xml
index de6b73012adb..8a48c73fbd34 100644
--- a/reference/image/functions/image-type-to-extension.xml
+++ b/reference/image/functions/image-type-to-extension.xml
@@ -48,6 +48,30 @@
</para>
</refsect1>
+ <refsect1 role="changelog">
+ &reftitle.changelog;
+ <informaltable>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>&Version;</entry>
+ <entry>&Description;</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>8.5.0</entry>
+ <entry>
+ Added support for <constant>IMAGETYPE_HEIF</constant>
(<literal>.heif</literal>)
+ and, if the <link linkend="book.libxml">libxml</link> extension is
+ loaded, <constant>IMAGETYPE_SVG</constant>
(<literal>.svg</literal>).
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
+ </refsect1>
+
<refsect1 role="examples">
&reftitle.examples;
<para>
diff --git a/reference/image/functions/image-type-to-mime-type.xml
b/reference/image/functions/image-type-to-mime-type.xml
index bffb2c50ac7e..913f4651cf72 100644
--- a/reference/image/functions/image-type-to-mime-type.xml
+++ b/reference/image/functions/image-type-to-mime-type.xml
@@ -129,6 +129,13 @@
<entry><constant>IMAGETYPE_HEIF</constant></entry>
<entry><literal>image/heif</literal></entry>
</row>
+ <row>
+ <entry>
+ <constant>IMAGETYPE_SVG</constant> (only if the
+ <link linkend="book.libxml">libxml</link> extension is loaded)
+ </entry>
+ <entry><literal>image/svg+xml</literal></entry>
+ </row>
</tbody>
</tgroup>
</table>