Sophie

Sophie

distrib > PLD > ac > amd64 > media > dist > by-pkgid > dd8ef74e7a184506d40e4328053fb785 > files > 717

php-manual-ro-20051028-1.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML
><HEAD
><TITLE
>exif_read_data</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="Manual PHP"
HREF="index.html"><LINK
REL="UP"
TITLE="Image Functions"
HREF="ref.image.html"><LINK
REL="PREVIOUS"
TITLE="exif_imagetype"
HREF="function.exif-imagetype.html"><LINK
REL="NEXT"
TITLE="exif_thumbnail"
HREF="function.exif-thumbnail.html"><META
HTTP-EQUIV="Content-type"
CONTENT="text/html; charset=ISO-8859-2"></HEAD
><BODY
CLASS="refentry"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>Manual PHP</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="function.exif-imagetype.html"
ACCESSKEY="P"
>Înapoi</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="function.exif-thumbnail.html"
ACCESSKEY="N"
>Înainte</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="function.exif-read-data"
></A
>exif_read_data</H1
><DIV
CLASS="refnamediv"
><A
NAME="AEN37977"
></A
><P
>    (PHP 4 &#62;= 4.2.0, PHP 5)</P
>exif_read_data&nbsp;--&nbsp;Reads the <ACRONYM
CLASS="acronym"
>EXIF</ACRONYM
> headers from <ACRONYM
CLASS="acronym"
>JPEG</ACRONYM
>
    or <ACRONYM
CLASS="acronym"
>TIFF</ACRONYM
>. This way you can read meta data generated by digital
    cameras.</DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN37983"
></A
><H2
>Description</H2
>array <B
CLASS="methodname"
>exif_read_data</B
> ( string filename [, string sections [, bool arrays [, bool thumbnail]]])<BR
></BR
><P
>&#13;     The <B
CLASS="function"
>exif_read_data()</B
> function reads the
     EXIF headers from a JPEG or TIFF image file. It returns an associative
     array where the indexes are the header names and the values
     are the values associated with those headers. If no data can be returned
     the result is <TT
CLASS="constant"
><B
>FALSE</B
></TT
>.
    </P
><P
>&#13;     <VAR
CLASS="parameter"
>filename</VAR
> is the name of the file to read. This
     cannot be a URL.
    </P
><P
>&#13;     <VAR
CLASS="parameter"
>sections</VAR
> is a comma separated list of sections that
     need to be present in file to produce a result array. If none of the 
     requested sections could be found the return value is <TT
CLASS="constant"
><B
>FALSE</B
></TT
>.
     <DIV
CLASS="informaltable"
><P
></P
><A
NAME="AEN38008"
></A
><TABLE
BORDER="1"
CLASS="CALSTABLE"
><COL><COL><TBODY
><TR
><TD
>FILE</TD
><TD
>FileName, FileSize, FileDateTime, SectionsFound</TD
></TR
><TR
><TD
>COMPUTED</TD
><TD
>html, Width, Height, IsColor and some more if available.
        </TD
></TR
><TR
><TD
>ANY_TAG</TD
><TD
>Any information that has a Tag e.g. IFD0, EXIF, ...</TD
></TR
><TR
><TD
>IFD0</TD
><TD
>All tagged data of IFD0. In normal imagefiles this contains
        image size and so forth.</TD
></TR
><TR
><TD
>THUMBNAIL</TD
><TD
>A file is supposed to contain a thumbnail if it has a second IFD.
        All tagged information about the embedded thumbnail is stored in this
        section.</TD
></TR
><TR
><TD
>COMMENT</TD
><TD
>Comment headers of JPEG images.</TD
></TR
><TR
><TD
>EXIF</TD
><TD
>The EXIF section is a sub section of IFD0. It contains
        more detailed information about an image. Most of these entries
        are digital camera related.</TD
></TR
></TBODY
></TABLE
><P
></P
></DIV
>
    </P
><P
>&#13;     <VAR
CLASS="parameter"
>arrays</VAR
> specifies whether or not each section
     becomes an array. The sections <SPAN
CLASS="emphasis"
><I
CLASS="emphasis"
>COMPUTED</I
></SPAN
>,
     <SPAN
CLASS="emphasis"
><I
CLASS="emphasis"
>THUMBNAIL</I
></SPAN
> and <SPAN
CLASS="emphasis"
><I
CLASS="emphasis"
>COMMENT</I
></SPAN
> allways
     become arrays as they may contain values whose names are conflict
     with other sections.
    </P
><P
>&#13;     <VAR
CLASS="parameter"
>thumbnail</VAR
> whether or not to read the thumbnail
     itself and not only its tagged data.
    </P
><DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>Not&#227;: </B
>
      Exif 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.
     </P
><P
>&#13;      Windows ME/XP both can wipe the Exif headers when connecting to a camera.
      More information available at <A
HREF="http://www.canon-asia.com/products/digital_cameras/winxp_problems.html"
TARGET="_top"
>http://www.canon-asia.com/products/digital_cameras/winxp_problems.html</A
>.
     </P
></BLOCKQUOTE
></DIV
><P
>&#13;     <TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
CLASS="EXAMPLE"
><TR
><TD
><DIV
CLASS="example"
><A
NAME="AEN38044"
></A
><P
><B
>Exemplu 1. <B
CLASS="function"
>exif_read_data()</B
> example</B
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><code><font color="#000000">
<font color="#0000BB">&lt;?php<br /><br /></font><font color="#007700">echo </font><font color="#DD0000">"test1.jpg:&lt;br /&gt;\n"</font><font color="#007700">;<br /></font><font color="#0000BB">$exif </font><font color="#007700">= </font><font color="#0000BB">exif_read_data</font><font color="#007700">(</font><font color="#DD0000">'tests/test1.jpg'</font><font color="#007700">, </font><font color="#DD0000">'IFD0'</font><font color="#007700">);<br />echo </font><font color="#0000BB">$exif</font><font color="#007700">===</font><font color="#0000BB">false </font><font color="#007700">? </font><font color="#DD0000">"No header data found.&lt;br /&gt;\n" </font><font color="#007700">: </font><font color="#DD0000">"Image contains headers&lt;br /&gt;"</font><font color="#007700">;<br /><br /></font><font color="#0000BB">$exif </font><font color="#007700">= </font><font color="#0000BB">exif_read_data</font><font color="#007700">(</font><font color="#DD0000">'tests/test2.jpg'</font><font color="#007700">, </font><font color="#0000BB">0</font><font color="#007700">, </font><font color="#0000BB">true</font><font color="#007700">);<br />echo </font><font color="#DD0000">"test2.jpg:&lt;br /&gt;\n"</font><font color="#007700">;<br />foreach (</font><font color="#0000BB">$exif </font><font color="#007700">as </font><font color="#0000BB">$key </font><font color="#007700">=&gt; </font><font color="#0000BB">$section</font><font color="#007700">) {<br />&nbsp;&nbsp;&nbsp;&nbsp;foreach (</font><font color="#0000BB">$section </font><font color="#007700">as </font><font color="#0000BB">$name </font><font color="#007700">=&gt; </font><font color="#0000BB">$val</font><font color="#007700">) {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo </font><font color="#DD0000">"$key.$name: $val&lt;br /&gt;</font><font color="#007700">\n</font><font color="#DD0000">"</font><font color="#007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />}<br /></font><font color="#0000BB">?&gt;</font>
</font>
</code></TD
></TR
></TABLE
><P
>&#13;      The first call fails because the image has no header information.
       <TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><code><font color="#000000">
test1.jpg:<br />No header data found.<br />test2.jpg:<br />FILE.FileName: test2.jpg<br />FILE.FileDateTime: 1017666176<br />FILE.FileSize: 1240<br />FILE.FileType: 2<br />FILE.SectionsFound: ANY_TAG, IFD0, THUMBNAIL, COMMENT<br />COMPUTED.html: width="1" height="1"<br />COMPUTED.Height: 1<br />COMPUTED.Width: 1<br />COMPUTED.IsColor: 1<br />COMPUTED.ByteOrderMotorola: 1<br />COMPUTED.UserComment: Exif test image.<br />COMPUTED.UserCommentEncoding: ASCII<br />COMPUTED.Copyright: Photo (c) M.Boerger, Edited by M.Boerger.<br />COMPUTED.Copyright.Photographer: Photo (c) M.Boerger<br />COMPUTED.Copyright.Editor: Edited by M.Boerger.<br />IFD0.Copyright: Photo (c) M.Boerger<br />IFD0.UserComment: ASCII<br />THUMBNAIL.JPEGInterchangeFormat: 134<br />THUMBNAIL.JPEGInterchangeFormatLength: 523<br />COMMENT.0: Comment #1.<br />COMMENT.1: Comment #2.<br />COMMENT.2: Comment #3end<br />THUMBNAIL.JPEGInterchangeFormat: 134<br />THUMBNAIL.Thumbnail.Height: 1<br />THUMBNAIL.Thumbnail.Height: 1</font>
</code></TD
></TR
></TABLE
>
      </P
></DIV
></TD
></TR
></TABLE
>
    </P
><DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>Not&#227;: </B
>
      If the image contains any IFD0 data then COMPUTED contains the entry
      ByteOrderMotorola which is 0 for little-endian (intel) and 1 for
      big-endian (motorola) byte order. This was added in PHP 4.3.
     </P
><P
>&#13;      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 COMPUTED
      section will return both entries <SPAN
CLASS="emphasis"
><I
CLASS="emphasis"
>Copyright.Photographer</I
></SPAN
>
      and <SPAN
CLASS="emphasis"
><I
CLASS="emphasis"
>Copyright.Editor</I
></SPAN
> while the IFD0 sections contains
      the byte array with the NULL character that splits both entries. Or just the
      first entry if the datatype was wrong (normal behaviour of Exif). The
      COMPUTED will contain also an entry <SPAN
CLASS="emphasis"
><I
CLASS="emphasis"
>Copyright</I
></SPAN
> Which
      is either the original copyright string or it is a comma separated list of
      photo and editor copyright.
     </P
></BLOCKQUOTE
></DIV
><DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>Not&#227;: </B
>
      The tag UserComment 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
      IFD section only contains the encoding or a byte array. The COMPUTED section
      will store both in the entries <SPAN
CLASS="emphasis"
><I
CLASS="emphasis"
>UserCommentEncoding</I
></SPAN
> and
      <SPAN
CLASS="emphasis"
><I
CLASS="emphasis"
>UserComment</I
></SPAN
>. The entry <SPAN
CLASS="emphasis"
><I
CLASS="emphasis"
>UserComment</I
></SPAN
>
      is available in both cases so it should be used in preference to the value
      in IFD0 section.
     </P
><P
>&#13;      If the user comment uses Unicode or JIS encoding and the module mbstring is
      available this encoding will automatically changed according to the exif
      ini settings in the <TT
CLASS="filename"
>php.ini</TT
>. This was added in PHP 4.3.
     </P
></BLOCKQUOTE
></DIV
><DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>Not&#227;: </B
>
      Height and Width are computed the same way <A
HREF="function.getimagesize.html"
><B
CLASS="function"
>getimagesize()</B
></A
>
      does so their values must not be part of any header returned. Also html is
      a height/width text string to be used inside normal <ACRONYM
CLASS="acronym"
>HTML</ACRONYM
>.
     </P
></BLOCKQUOTE
></DIV
><DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>Not&#227;: </B
>
      Starting from PHP 4.3 the function can read all embedded <ACRONYM
CLASS="acronym"
>IFD</ACRONYM
>
      data including arrays (returned as such). Also the size of an embedded thumbnail
      is returned in <SPAN
CLASS="emphasis"
><I
CLASS="emphasis"
>THUMBNAIL</I
></SPAN
> subarray and the function
      <B
CLASS="function"
>exif_read_data()</B
> can return thumbnails in <ACRONYM
CLASS="acronym"
>TIFF</ACRONYM
>
      format. Last but not least there is no longer a maximum length for returned
      values (not until memory limit is reached).
     </P
></BLOCKQUOTE
></DIV
><DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>Not&#227;: </B
>
      This function is only available in PHP 4 compiled using
      <VAR
CLASS="option"
>--enable-exif</VAR
>.
      Its functionality and behaviour has changed in PHP 4.2. Earlier versions
      are very unstable.
     </P
><P
>&#13;      Since PHP 4.3 user comment can automatically change encoding if PHP 4 was
      compiled using <VAR
CLASS="option"
>--enable-mbstring</VAR
>.
     </P
><P
>&#13;      This function does not require the GD image library.
     </P
><P
>&#13;      See also <A
HREF="function.exif-thumbnail.html"
><B
CLASS="function"
>exif_thumbnail()</B
></A
> and <A
HREF="function.getimagesize.html"
><B
CLASS="function"
>getimagesize()</B
></A
>.
     </P
></BLOCKQUOTE
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="function.exif-imagetype.html"
ACCESSKEY="P"
>Înapoi</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Acas&#227;</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="function.exif-thumbnail.html"
ACCESSKEY="N"
>Înainte</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>exif_imagetype</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="ref.image.html"
ACCESSKEY="U"
>Sus</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>exif_thumbnail</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>