4 * PEL: PHP Exif Library.
5 * A library with support for reading and
6 * writing all Exif headers in JPEG and TIFF images using PHP.
8 * Copyright (C) 2005, 2007 Martin Geisler.
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program in the file COPYING; if not, write to the
22 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
23 * Boston, MA 02110-1301 USA
25 namespace lsolesen\pel;
28 * Class for dealing with JPEG comments.
30 * @author Martin Geisler <mgeisler@users.sourceforge.net>
31 * @license http://www.gnu.org/licenses/gpl.html GNU General Public
37 * Class representing JPEG comments.
39 * @author Martin Geisler <mgeisler@users.sourceforge.net>
42 class PelJpegComment extends PelJpegContent
50 private $comment = '';
53 * Construct a new JPEG comment.
55 * The new comment will contain the string given.
57 * @param string $comment
59 public function __construct($comment = '')
61 $this->comment = $comment;
65 * Load and parse data.
67 * This will load the comment from the data window passed.
69 * @param PelDataWindow $d
71 public function load(PelDataWindow $d)
73 $this->comment = $d->getBytes();
77 * Update the value with a new comment.
79 * Any old comment will be overwritten.
81 * @param string $comment
84 public function setValue($comment)
86 $this->comment = $comment;
92 * @return string the comment.
94 public function getValue()
96 return $this->comment;
100 * Turn this comment into bytes.
102 * @return string bytes representing this comment.
104 public function getBytes()
106 return $this->comment;
110 * Return a string representation of this object.
112 * @return string the same as {@link getValue()}.
114 public function __toString()
116 return $this->getValue();