Sophie

Sophie

distrib > Mandriva > 9.1 > ppc > media > main > by-pkgid > 0afeee9cca140e167a996902b9a677c5 > files > 550

php-manual-en-4.3.0-2mdk.noarch.rpm

<HTML
><HEAD
><TITLE
>exif_read_data</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="PHP Manual"
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-1"></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"
>PHP Manual</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="function.exif-imagetype.html"
ACCESSKEY="P"
>Prev</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"
>Next</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="AEN33931"
></A
><P
>    (PHP 4 &#62;= 4.2.0)</P
>exif_read_data&nbsp;--&nbsp;Read the <SPAN
CLASS="acronym"
>EXIF</SPAN
> headers from <SPAN
CLASS="acronym"
>JPEG</SPAN
>
    or <SPAN
CLASS="acronym"
>TIFF</SPAN
>. This way you can read meta data generated by digital
    cameras.</DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN33937"
></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;     <TT
CLASS="parameter"
><I
>filename</I
></TT
> is the name of the file to read. This
     cannot be a url.
    </P
><P
>&#13;     <TT
CLASS="parameter"
><I
>sections</I
></TT
> a comma separated list of sections that
     need to be present in file to produce a result array.
     <DIV
CLASS="informaltable"
><A
NAME="AEN33961"
></A
><P
></P
><TABLE
BORDER="1"
CLASS="CALSTABLE"
><TBODY
><TR
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>FILE</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>FileName, FileSize, FileDateTime, SectionsFound</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>COMPUTED</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>html, Width, Height, IsColor and some more if available. 
        </TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>ANY_TAG</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>Any information that has a Tag e.g. IFD0, EXIF, ...</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>IFD0</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>All tagged data of IFD0. In normal imagefiles this contains
        image size and so forth.</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>THUMBNAIL</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>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
ALIGN="LEFT"
VALIGN="MIDDLE"
>COMMENT</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>Comment headers of JPEG images.</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>EXIF</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>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;     <TT
CLASS="parameter"
><I
>arrays</I
></TT
> specifies whether or not each section
     becomes an array. The sections <SPAN
CLASS="emphasis"
><I
CLASS="emphasis"
>FILE</I
></SPAN
>,
     <SPAN
CLASS="emphasis"
><I
CLASS="emphasis"
>COMPUTED</I
></SPAN
> and <SPAN
CLASS="emphasis"
><I
CLASS="emphasis"
>THUMBNAIL</I
></SPAN
> allways
     become arrays as they may contain values whose names are conflict
     with other sections.
    </P
><P
>&#13;     <TT
CLASS="parameter"
><I
>thumbnail</I
></TT
> whether or not to read the thumbnail
     itself and not only its tagged data.
    </P
><DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>Note: </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
></BLOCKQUOTE
></DIV
><P
>&#13;     <TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
CLASS="EXAMPLE"
><TR
><TD
><DIV
CLASS="example"
><A
NAME="AEN33995"
></A
><P
><B
>Example 1. <B
CLASS="function"
>exif_read_data()</B
> example</B
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><PRE
CLASS="php"
>&#60;?php
echo "test1.jpg:&#60;br /&#62;\n";
$exif = exif_read_data ('tests/test1.jpg','IFD0');
echo $exif===false ? "No header data found.&#60;br /&#62;\n" : "Image contains headers&#60;br /&#62;";
$exif = exif_read_data ('tests/test2.jpg',0,true);
echo "test2.jpg:&#60;br /&#62;\n";
foreach($exif as $key=&#62;$section) {
    foreach($section as $name=&#62;$val) {
        echo "$key.$name: $val&#60;br /&#62;\n";
    }
}?&#62;</PRE
></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
><PRE
CLASS="php"
>test1.jpg:
No header data found.
test2.jpg:
FILE.FileName: test2.jpg
FILE.FileDateTime: 1017666176
FILE.FileSize: 1240
FILE.FileType: 2
FILE.SectionsFound: ANY_TAG, IFD0, THUMBNAIL, COMMENT
COMPUTED.html: width="1" height="1"
COMPUTED.Height: 1
COMPUTED.Width: 1
COMPUTED.IsColor: 1
COMPUTED.ByteOrderMotorola: 1
COMPUTED.UserComment: Exif test image.
COMPUTED.UserCommentEncoding: ASCII
COMPUTED.Copyright: Photo (c) M.Boerger, Edited by M.Boerger.
COMPUTED.Copyright.Photographer: Photo (c) M.Boerger
COMPUTED.Copyright.Editor: Edited by M.Boerger.
IFD0.Copyright: Photo (c) M.Boerger
IFD0.UserComment: ASCII
THUMBNAIL.JPEGInterchangeFormat: 134
THUMBNAIL.JPEGInterchangeFormatLength: 523
COMMENT.0: Comment #1.
COMMENT.1: Comment #2.
COMMENT.2: Comment #3end

THUMBNAIL.JPEGInterchangeFormat: 134
THUMBNAIL.Thumbnail.Height: 1
THUMBNAIL.Thumbnail.Height: 1</PRE
></TD
></TR
></TABLE
>
      </P
></DIV
></TD
></TR
></TABLE
>
    </P
><DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>Note: </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 inconsitent 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
>Note: </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. This was added in PHP 4.3.
     </P
></BLOCKQUOTE
></DIV
><DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>Note: </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 <SPAN
CLASS="acronym"
>HTML</SPAN
>.
     </P
></BLOCKQUOTE
></DIV
><DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>Note: </B
>
     Starting from PHP 4.3 the function can read all embedded <SPAN
CLASS="acronym"
>IFD</SPAN
>
     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 <SPAN
CLASS="acronym"
>TIFF</SPAN
>
     format. Last but not least there is no longer a maximum legth for returned
     values (not until memory limit is reached).
     </P
></BLOCKQUOTE
></DIV
><DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>Note: </B
>
       This function is only available in PHP 4 compiled using 
       <TT
CLASS="option"
>--enable-exif</TT
>.
       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 <TT
CLASS="option"
>--enable-mbstring</TT
>.
      </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"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="function.exif-thumbnail.html"
ACCESSKEY="N"
>Next</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"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>exif_thumbnail</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>