1 | <?php |
---|
2 | /* |
---|
3 | * --:: JPEG MetaDatas ::------------------------------------------------------- |
---|
4 | * |
---|
5 | * Author : Grum |
---|
6 | * email : grum at piwigo.org |
---|
7 | * website : http://photos.grum.fr |
---|
8 | * |
---|
9 | * << May the Little SpaceFrog be with you ! >> |
---|
10 | * |
---|
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 | * +-----------------------------------------------------------------------+ |
---|
31 | * |
---|
32 | * |
---|
33 | * ----------------------------------------------------------------------------- |
---|
34 | * |
---|
35 | * The ComReader class is the dedicated class to read the COM structure |
---|
36 | * |
---|
37 | * ----------------------------------------------------------------------------- |
---|
38 | * |
---|
39 | * .. Notes .. |
---|
40 | * |
---|
41 | * |
---|
42 | * This class provides theses public functions : |
---|
43 | * - getComment |
---|
44 | * |
---|
45 | * ----------------------------------------------------------------------------- |
---|
46 | */ |
---|
47 | |
---|
48 | require_once(JPEG_METADATA_DIR."Common/Data.class.php"); |
---|
49 | require_once(JPEG_METADATA_DIR."TagDefinitions/ComTags.class.php"); |
---|
50 | |
---|
51 | class ComReader extends GenericReader |
---|
52 | { |
---|
53 | private $comment; |
---|
54 | /** |
---|
55 | * The constructor need the Com block datas (given as a Data object) |
---|
56 | * |
---|
57 | * @param Data $data : |
---|
58 | */ |
---|
59 | function __construct($data) |
---|
60 | { |
---|
61 | parent::__construct($data); |
---|
62 | $this->comment=$this->data->readASCII(); |
---|
63 | $this->tagDef = new ComTags(); |
---|
64 | |
---|
65 | $tag=$this->tagDef->getTagById('comment'); |
---|
66 | |
---|
67 | $entry=new Tag(); |
---|
68 | $entry->setKnown(true); |
---|
69 | $entry->setName($tag['tagName']); |
---|
70 | $entry->setImplemented($tag['implemented']); |
---|
71 | $entry->setTranslatable($tag['translatable']); |
---|
72 | $entry->setSchema($tag['schema']); |
---|
73 | $entry->setValue($this->comment); |
---|
74 | $entry->setLabel($this->comment); |
---|
75 | $this->entries[]=$entry; |
---|
76 | } |
---|
77 | |
---|
78 | function __destruct() |
---|
79 | { |
---|
80 | unset($this->comment); |
---|
81 | parent::__destruct(); |
---|
82 | } |
---|
83 | |
---|
84 | /** |
---|
85 | * return the comment value |
---|
86 | * |
---|
87 | * @return String |
---|
88 | */ |
---|
89 | public function getComment() |
---|
90 | { |
---|
91 | return($this->comment); |
---|
92 | } |
---|
93 | |
---|
94 | public function toString() |
---|
95 | { |
---|
96 | $returned="COM block value: ".$this->comment; |
---|
97 | return($returned); |
---|
98 | } |
---|
99 | } |
---|
100 | |
---|
101 | |
---|
102 | ?> |
---|