Verzeichnisstruktur phpBB-3.3.15
- Veröffentlicht
- 28.08.2024
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
TypeJp2.php
01 <?php
02
03 /**
04 * fast-image-size image type jpeg 2000
05 * @package fast-image-size
06 * @copyright (c) Marc Alexander <admin@m-a-styles.de>
07 *
08 * For the full copyright and license information, please view the LICENSE
09 * file that was distributed with this source code.
10 */
11
12 namespace FastImageSize\Type;
13
14 class TypeJp2 extends TypeBase
15 {
16 /** @var string JPEG 2000 signature */
17 const JPEG_2000_SIGNATURE = "\x00\x00\x00\x0C\x6A\x50\x20\x20\x0D\x0A\x87\x0A";
18
19 /** @var string JPEG 2000 SOC marker */
20 const JPEG_2000_SOC_MARKER = "\xFF\x4F";
21
22 /** @var string JPEG 2000 SIZ marker */
23 const JPEG_2000_SIZ_MARKER = "\xFF\x51";
24
25 /**
26 * {@inheritdoc}
27 */
28 public function getSize($filename)
29 {
30 $data = $this->fastImageSize->getImage($filename, 0, TypeJpeg::JPEG_MAX_HEADER_SIZE, false);
31
32 // Check if file is jpeg 2000
33 if (substr($data, 0, strlen(self::JPEG_2000_SIGNATURE)) !== self::JPEG_2000_SIGNATURE)
34 {
35 return;
36 }
37
38 // Get SOC position before starting to search for SIZ.
39 // Make sure we do not get SIZ before SOC by cutting at SOC.
40 $data = substr($data, strpos($data, self::JPEG_2000_SOC_MARKER));
41
42 // Remove SIZ and everything before
43 $data = substr($data, strpos($data, self::JPEG_2000_SIZ_MARKER) + self::SHORT_SIZE);
44
45 // Acquire size info from data
46 $size = unpack('Nwidth/Nheight', substr($data, self::LONG_SIZE, self::LONG_SIZE * 2));
47
48 $this->fastImageSize->setSize($size);
49 $this->fastImageSize->setImageType(IMAGETYPE_JPEG2000);
50 }
51 }
52