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

TypeWbmp.php

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


01  <?php
02   
03  /**
04   * fast-image-size image type wbmp
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 TypeWbmp extends TypeBase
17  {
18      /**
19       * {@inheritdoc}
20       */
21      public function getSize(string $filename, ImageReader $imageReader): ?array
22      {
23          $data = $imageReader->getImage($filename, 0, self::LONG_SIZE);
24   
25          // Check if image is WBMP
26          if ($data === false || !$this->validWBMP($data))
27          {
28              return null;
29          }
30   
31          $size = unpack('Cwidth/Cheight', substr($data, self::SHORT_SIZE, self::SHORT_SIZE));
32   
33          // Check if dimensions are valid. A file might be recognised as WBMP
34          // rather easily (see extra check for JPEG2000).
35          if (!$this->validDimensions($size))
36          {
37              return null;
38          }
39   
40          $size['type'] = IMAGETYPE_WBMP;
41          return $size;
42      }
43   
44      /**
45       * Return if supplied data might be part of a valid WBMP file
46       *
47       * @param string $data
48       *
49       * @return bool True if data might be part of a valid WBMP file, else false
50       */
51      protected function validWBMP(string $data): bool
52      {
53          return ord($data[0]) === 0 && ord($data[1]) === 0 && $data !== substr(TypeJp2::JPEG_2000_SIGNATURE, 0, self::LONG_SIZE);
54      }
55   
56      /**
57       * Return whether dimensions are valid
58       *
59       * @param array $size Size array
60       *
61       * @return bool True if dimensions are valid, false if not
62       */
63      protected function validDimensions(array $size): bool
64      {
65          return $size['height'] > 0 && $size['width'] > 0;
66      }
67  }
68