mirror of
https://github.com/chillerlan/php-qrcode.git
synced 2026-10-16 16:55:28 +00:00
✨ added QRGdImageAVIF
This commit is contained in:
@@ -83,6 +83,7 @@ abstract class QRGdImage extends QROutputAbstract{
|
||||
}
|
||||
|
||||
$modes = [
|
||||
QRGdImageAVIF::class => 'AVIF Support',
|
||||
QRGdImageBMP::class => 'BMP Support',
|
||||
QRGdImageGIF::class => 'GIF Create Support',
|
||||
QRGdImageJPEG::class => 'JPEG Support',
|
||||
@@ -90,7 +91,7 @@ abstract class QRGdImage extends QROutputAbstract{
|
||||
QRGdImageWEBP::class => 'WebP Support',
|
||||
];
|
||||
|
||||
// likely using custom output
|
||||
// likely using custom output/manual invocation
|
||||
if(!isset($modes[$this->options->outputInterface])){
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* Class QRGdImageAVIF
|
||||
*
|
||||
* @created 26.11.2023
|
||||
* @author smiley <smiley@chillerlan.net>
|
||||
* @copyright 2023 smiley
|
||||
* @license MIT
|
||||
*
|
||||
* @noinspection PhpComposerExtensionStubsInspection
|
||||
*/
|
||||
|
||||
namespace chillerlan\QRCode\Output;
|
||||
|
||||
use function imageavif, max, min;
|
||||
|
||||
/**
|
||||
* GDImage avif output
|
||||
*
|
||||
* @see \imageavif()
|
||||
*/
|
||||
class QRGdImageAVIF extends QRGdImage{
|
||||
|
||||
final public const MIME_TYPE = 'image/avif';
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function renderImage():void{
|
||||
imageavif($this->image, null, max(-1, min(100, $this->options->quality)));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -24,18 +24,19 @@ interface QROutputInterface{
|
||||
* @see https://github.com/chillerlan/php-qrcode/issues/223
|
||||
*/
|
||||
public const MODES = [
|
||||
QRMarkupSVG::class,
|
||||
QRMarkupHTML::class,
|
||||
QREps::class,
|
||||
QRFpdf::class,
|
||||
QRGdImageAVIF::class,
|
||||
QRGdImageBMP::class,
|
||||
QRGdImageGIF::class,
|
||||
QRGdImageJPEG::class,
|
||||
QRGdImagePNG::class,
|
||||
QRGdImageWEBP::class,
|
||||
QRImagick::class,
|
||||
QRMarkupHTML::class,
|
||||
QRMarkupSVG::class,
|
||||
QRStringJSON::class,
|
||||
QRStringText::class,
|
||||
QRImagick::class,
|
||||
QRFpdf::class,
|
||||
QREps::class,
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user