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.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

(Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

TypeIco.php

Zuletzt modifiziert: 01.05.2026, 11:27 - Dateigröße: 1.51 KiB


01  <?php
02   
03  /**
04   * fast-image-size image type ico
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 TypeIco extends TypeBase
17  {
18      /** @var string ICO reserved field */
19      const ICO_RESERVED = 0;
20   
21      /** @var int ICO type field */
22      const ICO_TYPE = 1;
23   
24      /**
25       * {@inheritdoc}
26       */
27      public function getSize(string $filename, ImageReader $imageReader): ?array
28      {
29          // Retrieve image data for ICO header and header of first entry.
30          // We assume the first entry to have the same size as the other ones.
31          $data = $imageReader->getImage($filename, 0, 2 * self::LONG_SIZE);
32   
33          if ($data === false)
34          {
35              return null;
36          }
37   
38          // Check if header fits expected format
39          if (!$this->isValidIco($data))
40          {
41              return null;
42          }
43   
44          $size = unpack('Cwidth/Cheight', substr($data, self::LONG_SIZE + self::SHORT_SIZE, self::SHORT_SIZE));
45          $size['type'] = IMAGETYPE_ICO;
46   
47          return $size;
48      }
49   
50      /**
51       * Return whether image is a valid ICO file
52       *
53       * @param string $data Image data string
54       *
55       * @return bool True if file is a valid ICO file, false if not
56       */
57      protected function isValidIco(string $data): bool
58      {
59          // Get header
60          $header = unpack('vreserved/vtype/vimages', $data);
61   
62          return $header['reserved'] === self::ICO_RESERVED && $header['type'] === self::ICO_TYPE && $header['images'] > 0 && $header['images'] <= 255;
63      }
64  }
65