aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/chillerlan/php-qrcode/src/Output/QRGdImageJPEG.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/chillerlan/php-qrcode/src/Output/QRGdImageJPEG.php')
-rw-r--r--vendor/chillerlan/php-qrcode/src/Output/QRGdImageJPEG.php40
1 files changed, 40 insertions, 0 deletions
diff --git a/vendor/chillerlan/php-qrcode/src/Output/QRGdImageJPEG.php b/vendor/chillerlan/php-qrcode/src/Output/QRGdImageJPEG.php
new file mode 100644
index 000000000..6be36e2fe
--- /dev/null
+++ b/vendor/chillerlan/php-qrcode/src/Output/QRGdImageJPEG.php
@@ -0,0 +1,40 @@
+<?php
+/**
+ * Class QRGdImageJPEG
+ *
+ * @created 25.10.2023
+ * @author smiley <smiley@chillerlan.net>
+ * @copyright 2023 smiley
+ * @license MIT
+ *
+ * @noinspection PhpComposerExtensionStubsInspection
+ */
+
+namespace chillerlan\QRCode\Output;
+
+use function imagejpeg, max, min;
+
+/**
+ * GdImage jpeg output
+ *
+ * @see \imagejpeg()
+ */
+class QRGdImageJPEG extends QRGdImage{
+
+ public const MIME_TYPE = 'image/jpg';
+
+ /**
+ * @inheritDoc
+ */
+ protected function setTransparencyColor():void{
+ // noop - transparency is not supported
+ }
+
+ /**
+ * @inheritDoc
+ */
+ protected function renderImage():void{
+ imagejpeg($this->image, null, max(-1, min(100, $this->options->quality)));
+ }
+
+}