mirror of
https://github.com/chillerlan/php-qrcode.git
synced 2026-10-14 15:57:13 +00:00
:octocat: integrate reader into QRCode, extract LuminanceSourceInterface
This commit is contained in:
@@ -20,7 +20,7 @@ use function count;
|
||||
* This class is used to help decode images from files which arrive as Imagick Resource
|
||||
* It does not support rotation.
|
||||
*/
|
||||
final class IMagickLuminanceSource extends LuminanceSource{
|
||||
final class IMagickLuminanceSource extends LuminanceSourceAbstract{
|
||||
|
||||
private Imagick $imagick;
|
||||
|
||||
@@ -53,4 +53,19 @@ final class IMagickLuminanceSource extends LuminanceSource{
|
||||
}
|
||||
}
|
||||
|
||||
/** @inheritDoc */
|
||||
public static function fromFile(string $path):self{
|
||||
$path = self::checkFile($path);
|
||||
|
||||
return new self(new Imagick($path));
|
||||
}
|
||||
|
||||
/** @inheritDoc */
|
||||
public static function fromBlob(string $blob):self{
|
||||
$im = new Imagick;
|
||||
$im->readImageBlob($blob);
|
||||
|
||||
return new self($im);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user