1
0
mirror of https://github.com/php/doc-en.git synced 2026-03-23 23:32:18 +01:00

exif: fix XML by converting para to simpara tags via script (#5143)

This commit is contained in:
Gina Peter Banyard
2026-01-18 22:11:19 +00:00
committed by GitHub
parent ca6054f609
commit 6a08181be1
9 changed files with 90 additions and 98 deletions

View File

@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<book xml:id="book.exif" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<book xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="book.exif">
<?phpdoc extension-membership="bundled" ?>
<title>Exchangeable image information</title>
<titleabbrev>Exif</titleabbrev>
@@ -9,22 +8,21 @@
<!-- {{{ preface -->
<preface xml:id="intro.exif">
&reftitle.intro;
<para>
<simpara>
With the exif extension you are able to work with image meta data. For
example, you may use exif functions to read meta data of pictures taken
from digital cameras by working with information stored in the headers.
These are commonly found in <acronym>JPEG</acronym> and
example, you may use exif functions to read meta data of pictures taken
from digital cameras by working with information stored in the headers.
These are commonly found in <acronym>JPEG</acronym> and
<acronym>TIFF</acronym> images.
</para>
</simpara>
</preface>
<!-- }}} -->
&reference.exif.setup;
&reference.exif.constants;
&reference.exif.reference;
</book>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
@@ -45,4 +43,3 @@ vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View File

@@ -1,21 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<section xml:id="exif.installation" xmlns="http://docbook.org/ns/docbook">
<section xmlns="http://docbook.org/ns/docbook" xml:id="exif.installation">
&reftitle.install;
<para>
To enable exif-support configure PHP with
<simpara>
To enable exif-support configure PHP with
<option role="configure">--enable-exif</option>
</para>
<para>
</simpara>
<simpara>
Windows users must enable both the <filename>php_mbstring.dll</filename>
and <filename>php_exif.dll</filename> DLL's in &php.ini;. The
<filename>php_mbstring.dll</filename> DLL must be loaded
and <filename>php_exif.dll</filename> DLL's in &php.ini;. The
<filename>php_mbstring.dll</filename> DLL must be loaded
<emphasis>before</emphasis> the <filename>php_exif.dll</filename> DLL so
adjust your &php.ini; accordingly.
</para>
</simpara>
</section>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml

View File

@@ -18,10 +18,10 @@
</listitem>
</varlistentry>
</variablelist>
<para>
<simpara>
The <function>exif_imagetype</function> lists several related built-in
constants.
</para>
</simpara>
</appendix>
<!-- Keep this comment at the end of the file
Local variables:

View File

@@ -12,16 +12,16 @@
<type class="union"><type>int</type><type>false</type></type><methodname>exif_imagetype</methodname>
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
</methodsynopsis>
<para>
<simpara>
<function>exif_imagetype</function> reads the first bytes of an image and
checks its signature.
</para>
<para>
</simpara>
<simpara>
<function>exif_imagetype</function> can be used to avoid calls to other
<link linkend="ref.exif">exif</link> functions with unsupported file types
or in conjunction with <varname>$_SERVER['HTTP_ACCEPT']</varname> to check
whether or not the viewer is able to see a specific image in the browser.
</para>
</simpara>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
@@ -38,12 +38,12 @@
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
<simpara>
When a correct signature is found, the appropriate constant value will be
returned otherwise the return value is &false;. The return value is the
same value that <function>getimagesize</function> returns in index 2 but
<function>exif_imagetype</function> is much faster.
</para>
</simpara>
<para>
The following constants are defined, and represent possible
<function>exif_imagetype</function> return values:
@@ -141,13 +141,13 @@
</para>
<note>
<para>
<simpara>
<function>exif_imagetype</function> will emit an <constant>E_NOTICE</constant>
and return &false; if it is unable to read enough bytes from the file to
determine the image type.
<!-- If the function finds an incomplete PNG header then it may emit an
<constant>E_WARNING</constant> instead. - Is this worth including? -->
</para>
</simpara>
</note>
</refsect1>

View File

@@ -15,24 +15,24 @@
<methodparam choice="opt"><type>bool</type><parameter>as_arrays</parameter><initializer>&false;</initializer></methodparam>
<methodparam choice="opt"><type>bool</type><parameter>read_thumbnail</parameter><initializer>&false;</initializer></methodparam>
</methodsynopsis>
<para>
<simpara>
<function>exif_read_data</function> reads the
<acronym>EXIF</acronym> headers from an image file. This way you can read meta data
generated by digital cameras.
</para>
<para>
</simpara>
<simpara>
<acronym>EXIF</acronym> headers tend to be present in JPEG/TIFF images generated by digital
cameras, but unfortunately each digital camera maker has a different
idea of how to actually tag their images, so you can't always rely on
a specific Exif header being present.
</para>
<para>
</simpara>
<simpara>
<literal>Height</literal> and <literal>Width</literal> are computed the
same way <function>getimagesize</function> does so their values must not be
part of any header returned. Also, <literal>html</literal> is a
height/width text string to be used inside normal <acronym>HTML</acronym>.
</para>
<para>
</simpara>
<simpara>
When an Exif header contains a Copyright note, this itself can contain two
values. As the solution is inconsistent in the Exif 2.10 standard, the
<literal>COMPUTED</literal> section will return both entries
@@ -43,8 +43,8 @@
of Exif). The <literal>COMPUTED</literal> will also contain the entry
<literal>Copyright</literal> which is either the original copyright string,
or a comma separated list of the photo and editor copyright.
</para>
<para>
</simpara>
<simpara>
The tag <literal>UserComment</literal> has the same problem as the Copyright
tag. It can store two values. First the encoding used, and second the value
itself. If so the <literal>IFD</literal> section only contains the encoding
@@ -53,11 +53,11 @@
<literal>UserComment</literal>. The entry <literal>UserComment</literal>
is available in both cases so it should be used in preference to the value
in <literal>IFD0</literal> section.
</para>
<para>
</simpara>
<simpara>
<function>exif_read_data</function> also validates EXIF data tags according
to the EXIF specification (<link xlink:href="&url.exifspec;">&url.exifspec;</link>, page 20).
</para>
</simpara>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
@@ -65,11 +65,11 @@
<varlistentry>
<term><parameter>file</parameter></term>
<listitem>
<para>
<simpara>
The location of the image file. This can either be a path to the file
(stream wrappers are also supported as usual)
or a stream <type>resource</type>.
</para>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
@@ -136,43 +136,43 @@
<varlistentry>
<term><parameter>as_arrays</parameter></term>
<listitem>
<para>
<simpara>
Specifies whether or not each section becomes an array. The
<parameter>required_sections</parameter> <literal>COMPUTED</literal>,
<literal>THUMBNAIL</literal>, and <literal>COMMENT</literal>
always become arrays as they may contain values whose names conflict
with other sections.
</para>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>read_thumbnail</parameter></term>
<listitem>
<para>
<simpara>
When set to &true; the thumbnail itself is read. Otherwise, only the
tagged data is read.
</para>
</simpara>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
<simpara>
It returns an associative <type>array</type> where the array indexes are
the header names and the array values are the values associated with
those headers. If no data can be returned,
<function>exif_read_data</function> will return &false;.
</para>
</simpara>
</refsect1>
<refsect1 role="errors">
&reftitle.errors;
<para>
<simpara>
Errors of level <constant>E_WARNING</constant> and/or <constant>E_NOTICE</constant>
may be raised for unsupported tags or other potential error conditions, but the
function still tries to read all comprehensible information.
</para>
</simpara>
</refsect1>
<refsect1 role="changelog">
@@ -245,9 +245,9 @@ foreach ($exif as $key => $section) {
?>
]]>
</programlisting>
<para>
<simpara>
The first call fails because the image has no header information.
</para>
</simpara>
&example.outputs.similar;
<screen role="php">
<![CDATA[
@@ -333,7 +333,7 @@ EXIF Headers:
<refsect1 role="notes">
&reftitle.notes;
<note>
<para>
<simpara>
If <link linkend="ref.mbstring">mbstring</link> is enabled, exif will attempt to process
the unicode and pick a charset as specified by
<link linkend="ini.exif.decode-unicode-motorola">exif.decode_unicode_motorola</link> and
@@ -341,13 +341,13 @@ EXIF Headers:
extension will not attempt to figure out the encoding on its own, and it is up to the user
to properly specify the encoding for which to use for decoding by setting one of these two
ini directives prior to calling <function>exif_read_data</function>.
</para>
</simpara>
</note>
<note>
<para>
<simpara>
If the <parameter>file</parameter> is used to pass a stream to this function, then the stream
must be seekable. Note that the file pointer position is not changed after this function returns.
</para>
</simpara>
</note>
</refsect1>
<refsect1 role="seealso">

View File

@@ -18,19 +18,19 @@
<varlistentry>
<term><parameter>index</parameter></term>
<listitem>
<para>
<simpara>
The Tag ID for which a Tag Name will be looked up.
</para>
</simpara>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
<simpara>
Returns the header name, or &false; if <parameter>index</parameter> is
not a defined EXIF tag id.
</para>
</simpara>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;

View File

@@ -15,19 +15,19 @@
<methodparam choice="opt"><type>int</type><parameter role="reference">height</parameter><initializer>&null;</initializer></methodparam>
<methodparam choice="opt"><type>int</type><parameter role="reference">image_type</parameter><initializer>&null;</initializer></methodparam>
</methodsynopsis>
<para>
<simpara>
<function>exif_thumbnail</function> reads the embedded thumbnail of an image.
</para>
<para>
</simpara>
<simpara>
If you want to deliver thumbnails through this function, you should send
the mimetype information using the <function>header</function> function.
</para>
<para>
</simpara>
<simpara>
It is possible that <function>exif_thumbnail</function> cannot create an
image but can determine its size. In this case, the return value is
&false; but <parameter>width</parameter> and <parameter>height</parameter>
are set.
</para>
</simpara>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
@@ -35,45 +35,45 @@
<varlistentry>
<term><parameter>file</parameter></term>
<listitem>
<para>
<simpara>
The location of the image file. This can either be a path to the file
or a stream <type>resource</type>.
</para>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>width</parameter></term>
<listitem>
<para>
<simpara>
The return width of the returned thumbnail.
</para>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>height</parameter></term>
<listitem>
<para>
<simpara>
The returned height of the returned thumbnail.
</para>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>image_type</parameter></term>
<listitem>
<para>
<simpara>
The returned image type of the returned thumbnail. This is either
<acronym>TIFF</acronym> or <acronym>JPEG</acronym>.
</para>
</simpara>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
<simpara>
Returns the embedded thumbnail, or &false; if the image contains no
thumbnail.
</para>
</simpara>
</refsect1>
<refsect1 role="changelog">
@@ -125,10 +125,10 @@ if ($image!==false) {
<refsect1 role="notes">
&reftitle.notes;
<note>
<para>
<simpara>
If the <parameter>file</parameter> is used to pass a stream to this function, then the stream
must be seekable. Note that the file pointer position is not changed after this function returns.
</para>
</simpara>
</note>
</refsect1>
<refsect1 role="seealso">

View File

@@ -74,7 +74,7 @@
<type>string</type>
</term>
<listitem>
<para>
<simpara>
<literal>exif.encode_unicode</literal> defines the
characterset UNICODE user comments are handled.
This defaults to ISO-8859-15 which should work for
@@ -82,7 +82,7 @@
or must be an encoding supported by mbstring. If it
is empty the current internal encoding of mbstring is
used.
</para>
</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="ini.exif.decode-unicode-motorola">
@@ -91,13 +91,13 @@
<type>string</type>
</term>
<listitem>
<para>
<simpara>
<literal>exif.decode_unicode_motorola</literal> defines
the image internal characterset for Unicode encoded user
comments if image is in motorola byte order (big-endian).
This setting cannot be empty but you can specify a list
of encodings supported by mbstring. The default is UCS-2BE.
</para>
</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="ini.exif.decode-unicode-intel">
@@ -106,13 +106,13 @@
<type>string</type>
</term>
<listitem>
<para>
<simpara>
<literal>exif.decode_unicode_intel</literal> defines
the image internal characterset for Unicode encoded user
comments if image is in intel byte order (little-endian).
This setting cannot be empty but you can specify a list
of encodings supported by mbstring. The default is UCS-2LE.
</para>
</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="ini.exif.encode-jis">
@@ -121,13 +121,13 @@
<type>string</type>
</term>
<listitem>
<para>
<simpara>
<literal>exif.encode_jis</literal> defines the
characterset JIS user comments are handled.
This defaults to an empty value which forces
the functions to use the current internal encoding
of mbstring.
</para>
</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="ini.exif.decode-jis-motorola">
@@ -136,13 +136,13 @@
<type>string</type>
</term>
<listitem>
<para>
<simpara>
<literal>exif.decode_jis_motorola</literal> defines
the image internal characterset for JIS encoded user
comments if image is in motorola byte order (big-endian).
This setting cannot be empty but you can specify a list
of encodings supported by mbstring. The default is JIS.
</para>
</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="ini.exif.decode-jis-intel">
@@ -151,13 +151,13 @@
<type>string</type>
</term>
<listitem>
<para>
<simpara>
<literal>exif.decode_jis_intel</literal> defines
the image internal characterset for JIS encoded user
comments if image is in intel byte order (little-endian).
This setting cannot be empty but you can specify a list
of encodings supported by mbstring. The default is JIS.
</para>
</simpara>
</listitem>
</varlistentry>
</variablelist>

View File

@@ -1,18 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<chapter xml:id="exif.setup" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="exif.setup">
&reftitle.setup;
<!-- {{{ Requirements -->
<section xml:id="exif.requirements">
&reftitle.required;
<para>
<simpara>
Your PHP must be compiled in with <literal>--enable-exif</literal>. To enable
multibyte support in EXIF tags, the <link linkend="ref.mbstring">mbstring</link>
extension must be enabled by compiling PHP with <literal>--enable-mbstring</literal>.
PHP does not require any additional library for the exif module.
</para>
</simpara>
</section>
<!-- }}} -->
@@ -25,7 +24,6 @@
<!-- }}} -->
</chapter>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
@@ -46,4 +44,3 @@ vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->