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 |
TypePng.php
01 <?php
02
03 /**
04 * fast-image-size image type png
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 TypePng extends TypeBase
15 {
16 /** @var string PNG header */
17 const PNG_HEADER = "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a";
18
19 /** @var int PNG IHDR offset */
20 const PNG_IHDR_OFFSET = 12;
21
22 /**
23 * {@inheritdoc}
24 */
25 public function getSize($filename)
26 {
27 // Retrieve image data including the header, the IHDR tag, and the
28 // following 2 chunks for the image width and height
29 $data = $this->fastImageSize->getImage($filename, 0, self::PNG_IHDR_OFFSET + 3 * self::LONG_SIZE);
30
31 // Check if header fits expected format specified by RFC 2083
32 if (substr($data, 0, self::PNG_IHDR_OFFSET - self::LONG_SIZE) !== self::PNG_HEADER || substr($data, self::PNG_IHDR_OFFSET, self::LONG_SIZE) !== 'IHDR')
33 {
34 return;
35 }
36
37 $size = unpack('Nwidth/Nheight', substr($data, self::PNG_IHDR_OFFSET + self::LONG_SIZE, self::LONG_SIZE * 2));
38
39 $this->fastImageSize->setSize($size);
40 $this->fastImageSize->setImageType(IMAGETYPE_PNG);
41 }
42 }
43