Verzeichnisstruktur phpBB-3.2.0


Veröffentlicht
06.01.2017

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