Closed peter279k closed 5 years ago
As title, the PSB detection is failed, and I tihnk we should enhance PsdDetector class.
PSB
PsdDetector
<?php namespace Selective\ImageType\Detector; use Selective\ImageType\ImageType; use SplFileObject; /** * Detector. */ final class PsbDetector implements DetectorInterface { /** * PSB (Photoshop Large Document) identification. * * @param SplFileObject $file The image file * * @return ImageType|null The image type */ public function detect(SplFileObject $file): ?ImageType { return $file->fread(5) === "8BPS\0\2" ? new ImageType(ImageType::PSB) : null; } }
<?php namespace Selective\ImageType\Detector; use Selective\ImageType\ImageType; use SplFileObject; /** * Detector. */ final class PsdDetector implements DetectorInterface { /** * PSD identification. * * @param SplFileObject $file The image file * * @return ImageType|null The image type */ public function detect(SplFileObject $file): ?ImageType { return $file->fread(2) === '8B' ? new ImageType(ImageType::PSD) : null; } }
It looks like the psd and psb identification detection is different.
psd
psb
'8' 'B' 'P' 'S' 0x00 0x01
'8' 'B' 'P' 'S' 0x00 0x02
It should be fixed now. Thanks.
As title, the
PSB
detection is failed, and I tihnk we should enhancePsdDetector
class.