Verzeichnisstruktur phpBB-3.3.16
- Veröffentlicht
- 27.04.2026
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 use FastImageSize\ImageReader;
15
16 class TypePng extends TypeBase
17 {
18 /** @var string PNG header */
19 const PNG_HEADER = "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a";
20
21 /** @var int PNG IHDR offset */
22 const PNG_IHDR_OFFSET = 12;
23
24 /**
25 * {@inheritdoc}
26 */
27 public function getSize(string $filename, ImageReader $imageReader): ?array
28 {
29 // Retrieve image data including the header, the IHDR tag, and the
30 // following 2 chunks for the image width and height
31 $data = $imageReader->getImage($filename, 0, self::PNG_IHDR_OFFSET + 3 * self::LONG_SIZE);
32
33 // Check if header fits expected format specified by RFC 2083
34 if ($data === false || substr($data, 0, self::PNG_IHDR_OFFSET - self::LONG_SIZE) !== self::PNG_HEADER || substr($data, self::PNG_IHDR_OFFSET, self::LONG_SIZE) !== 'IHDR')
35 {
36 return null;
37 }
38
39 $size = unpack('Nwidth/Nheight', substr($data, self::PNG_IHDR_OFFSET + self::LONG_SIZE, self::LONG_SIZE * 2));
40 $size['type'] = IMAGETYPE_PNG;
41
42 return $size;
43 }
44 }
45