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 | * Define the maker notes signatures for the EXIF "MakerNote" tag |
---|
36 | * |
---|
37 | * This class provides theses public functions : |
---|
38 | * - (static) getMaker |
---|
39 | * |
---|
40 | * ----------------------------------------------------------------------------- |
---|
41 | */ |
---|
42 | |
---|
43 | define("MAKER_PENTAX", "Pentax"); |
---|
44 | define("MAKER_NIKON", "Nikon"); |
---|
45 | define("MAKER_CANON", "Canon"); |
---|
46 | |
---|
47 | Class MakerNotesSignatures |
---|
48 | { |
---|
49 | /** Olympus signature */ |
---|
50 | const OlympusHeader = "OLYMP\x00\x01\x00"; |
---|
51 | /** Olympus 2 signature */ |
---|
52 | const Olympus2Header = "OLYMPUS\x00II\x03\x00"; |
---|
53 | /** FujiFilm signature */ |
---|
54 | const FujiFilmHeader = "FUJIFILM\x0c\x00\x00\x00"; |
---|
55 | /** Nikon 2 signature */ |
---|
56 | const Nikon2Header = "Nikon\x00\x01\x00"; |
---|
57 | /** Nikon 3 signature */ |
---|
58 | const Nikon3Header = "Nikon\x00\x02"; |
---|
59 | /** Panasonic signature */ |
---|
60 | const PanasonicHeader = "Panasonic\x00\x00\x00"; |
---|
61 | /** Pentax MM signature */ |
---|
62 | const PentaxHeader = "AOC\x00MM"; |
---|
63 | /** Pentax II signature */ |
---|
64 | const Pentax2Header = "AOC\x00II"; |
---|
65 | /** Sigma signature */ |
---|
66 | const SigmaHeader = "SIGMA\x00\x00\x00\x01\x00"; |
---|
67 | /** Sigma signature */ |
---|
68 | const Sigma2Header = "FOVEON\x00\x00\x01\x00"; |
---|
69 | /** Sony signature */ |
---|
70 | const SonyHeader = "SONY DSC \x00\x00\x00"; |
---|
71 | /** Canon signature => no signature in the maker note field ! */ |
---|
72 | const CanonHeader = ""; |
---|
73 | /** Unknown signature => no signature in the maker note field ! */ |
---|
74 | const UnknownHeader = ""; |
---|
75 | |
---|
76 | |
---|
77 | const OlympusHeaderSize = 8; |
---|
78 | const Olympus2HeaderSize = 12; |
---|
79 | const FujiFilmHeaderSize = 12; |
---|
80 | const Nikon2HeaderSize = 8; |
---|
81 | const Nikon3HeaderSize = 7; |
---|
82 | const PanasonicHeaderSize = 12; |
---|
83 | const PentaxHeaderSize = 6; |
---|
84 | const Pentax2HeaderSize = 6; |
---|
85 | const SigmaHeaderSize = 8; |
---|
86 | const Sigma2HeaderSize = 8; |
---|
87 | const SonyHeaderSize = 12; |
---|
88 | const CanonHeaderSize = 0; |
---|
89 | const UnknownHeaderSize = 0; |
---|
90 | |
---|
91 | |
---|
92 | static public function getMaker($datas) |
---|
93 | { |
---|
94 | if(strlen($datas) >= self::OlympusHeaderSize and substr_compare($datas, self::OlympusHeader, 0, self::OlympusHeaderSize)===0) |
---|
95 | { return(self::OlympusHeader); } |
---|
96 | elseif(strlen($datas) >= self::Olympus2HeaderSize and substr_compare($datas, self::Olympus2Header, 0, self::Olympus2HeaderSize)===0) |
---|
97 | { return(self::Olympus2Header); } |
---|
98 | elseif(strlen($datas) >= self::FujiFilmHeaderSize and substr_compare($datas, self::FujiFilmHeader, 0, self::FujiFilmHeaderSize)===0) |
---|
99 | { return(self::FujiFilmHeader); } |
---|
100 | elseif(strlen($datas) >= self::Nikon2HeaderSize and substr_compare($datas, self::Nikon2Header, 0, self::Nikon2HeaderSize)===0) |
---|
101 | { return(self::Nikon2Header); } |
---|
102 | elseif(strlen($datas) >= self::Nikon3HeaderSize and substr_compare($datas, self::Nikon3Header, 0, self::Nikon3HeaderSize)===0) |
---|
103 | { return(self::Nikon3Header); } |
---|
104 | elseif(strlen($datas) >= self::PanasonicHeaderSize and substr_compare($datas, self::PanasonicHeader, 0, self::PanasonicHeaderSize)===0) |
---|
105 | { return(self::PanasonicHeader); } |
---|
106 | elseif(strlen($datas) >= self::PentaxHeaderSize and substr_compare($datas, self::PentaxHeader, 0, self::PentaxHeaderSize)===0) |
---|
107 | { return(self::PentaxHeader); } |
---|
108 | elseif(strlen($datas) >= self::Pentax2HeaderSize and substr_compare($datas, self::Pentax2Header, 0, self::Pentax2HeaderSize)===0) |
---|
109 | { return(self::Pentax2Header); } |
---|
110 | elseif(strlen($datas) >= self::SigmaHeaderSize and substr_compare($datas, self::SigmaHeader, 0, self::SigmaHeaderSize)===0) |
---|
111 | { return(self::SigmaHeader); } |
---|
112 | elseif(strlen($datas) >= self::Sigma2HeaderSize and substr_compare($datas, self::Sigma2Header, 0, self::Sigma2HeaderSize)===0) |
---|
113 | { return(self::Sigma2Header); } |
---|
114 | elseif(strlen($datas) >= self::SonyHeaderSize and substr_compare($datas, self::SonyHeader, 0, self::SonyHeaderSize)===0) |
---|
115 | { return(self::SonyHeader); } |
---|
116 | else |
---|
117 | { return(self::UnknownHeader); } |
---|
118 | } |
---|
119 | |
---|
120 | } |
---|
121 | |
---|
122 | ?> |
---|