Ignore:
Timestamp:
Jan 17, 2010, 7:05:35 PM (14 years ago)
Author:
grum
Message:

[Plugin:AMetaData] Finished to comment the JpegMetaData classes and rename some methods

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/AMetaData/JpegMetaData/Readers/TiffReader.class.php

    r4686 r4698  
    99 *   << May the Little SpaceFrog be with you ! >>
    1010 *
    11  * -----------------------------------------------------------------------------
     11 *
     12 * +-----------------------------------------------------------------------+
     13 * | JpegMetaData - a PHP based Jpeg Metadata manager                      |
     14 * +-----------------------------------------------------------------------+
     15 * | Copyright(C) 2010  Grum - http://www.grum.fr                          |
     16 * +-----------------------------------------------------------------------+
     17 * | This program is free software; you can redistribute it and/or modify  |
     18 * | it under the terms of the GNU General Public License as published by  |
     19 * | the Free Software Foundation                                          |
     20 * |                                                                       |
     21 * | This program is distributed in the hope that it will be useful, but   |
     22 * | WITHOUT ANY WARRANTY; without even the implied warranty of            |
     23 * | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
     24 * | General Public License for more details.                              |
     25 * |                                                                       |
     26 * | You should have received a copy of the GNU General Public License     |
     27 * | along with this program; if not, write to the Free Software           |
     28 * | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
     29 * | USA.                                                                  |
     30 * +-----------------------------------------------------------------------+
    1231 *
    1332 *
    1433 * -----------------------------------------------------------------------------
    1534 *
     35 * The TiffReader class is the dedicated to read a TIFF structure
     36 *
     37 * A Tiff structure is formatted as this :
     38 *  - byte order            : 2 bytes, "II" or "MM", indicates the byte order
     39 *  - header tag            : 2 bytes, UShort equals 0x002a
     40 *  - first IFD offset      : 4 bytes, ULong
     41 *  - IFDs                  :
     42 *
     43 * => See IfdReader.class.php & IfdEntryReader.class.php to know more on IFD <==
     44 *
     45 * -----------------------------------------------------------------------------
     46 *
     47 * .. Notes ..
     48 *
     49 *
     50 * The TiffReader class is derived from the SegmentReader class.
     51 *
     52 * ======> See SegmentReader.class.php to know more about common methods <======
     53 *
     54 *
     55 * This class provides theses public functions :
     56 *  - getNbIFDs
     57 *  - getIFDs
     58 *  - getIFD
     59 *
    1660 * -----------------------------------------------------------------------------
    1761 */
     62
    1863
    1964  require_once(JPEG_METADATA_DIR."Common/ConvertData.class.php");
     
    2974    private $firstIFDOffset = 0;
    3075
     76    /**
     77     * The constructor need the Tiff block datas (given as a Data object) and
     78     * offset of the TIFF block inside the jpeg file
     79     *
     80     * @param Data $data :
     81     * @param ULong $offsetData (optional) :
     82     */
    3183    function __construct(Data $data, $offsetData=0)
    3284    {
     
    48100
    49101        $header=$this->data->readUShort();
    50         if($header==0x2a)
     102        if($header==0x002a)
    51103        {
    52104          $this->isValid=true;
     
    62114    }
    63115
    64     private function readData()
    65     {
    66       $nextIFD = $this->firstIFDOffset;
    67       while($nextIFD!=0)
    68       {
    69         $this->data->seek($nextIFD);
    70         $IFD = new IfdReader($this->data->readASCII(), $nextIFD, $this->byteOrder);
    71         $this->IFDs[]=$IFD;
    72         $nextIFD = $IFD->getNextIFDOffset();
    73       }
    74     }
    75 
     116    /**
     117     * return the number of IFDs found in the Tiff block
     118     *
     119     * @return Integer
     120     */
    76121    public function getNbIFDs()
    77122    {
     
    79124    }
    80125
     126    /**
     127     * return an array of IFD found in the the Tiff block
     128     *
     129     * @return IFD[]
     130     */
    81131    public function getIFDs()
    82132    {
     
    84134    }
    85135
     136    /**
     137     * returns a specific IFD
     138     *
     139     * @param Integer $num : index of the needed IFD
     140     * @return IFD
     141     */
    86142    public function getIFD($num)
    87143    {
     
    91147        return(null);
    92148    }
    93 
    94149
    95150    public function toString()
     
    104159    }
    105160
     161    /**
     162     * The readData function read IFDs from the Tiff block, and add them into
     163     * the IFDs array
     164     */
     165    private function readData()
     166    {
     167      $nextIFD = $this->firstIFDOffset;
     168      /*
     169       * while the next IFD offset is not zero, read the IFD at the designed
     170       * offset
     171       *
     172       * the next IFD offset is given at the end of the last IFD read.
     173       */
     174      while($nextIFD!=0)
     175      {
     176        $this->data->seek($nextIFD);
     177        $IFD = new IfdReader($this->data->readASCII(), $nextIFD, $this->byteOrder);
     178        $this->IFDs[]=$IFD;
     179        $nextIFD = $IFD->getNextIFDOffset();
     180      }
     181    }
    106182  }
    107183
Note: See TracChangeset for help on using the changeset viewer.