Debian Codegraph @

vendor/chillerlan/php-qrcode/src/Output/QRGdImageJPEG.php

raw
1 <?php
2 /**
3 * Class QRGdImageJPEG
4 *
5 * @created 25.10.2023
6 * @author smiley <[email protected]>
7 * @copyright 2023 smiley
8 * @license MIT
9 *
10 * @noinspection PhpComposerExtensionStubsInspection
11 */
12 declare(strict_types=1);
13
14 namespace chillerlan\QRCode\Output;
15
16 use function imagejpeg;
17
18 /**
19 * GdImage jpeg output
20 *
21 * @see \imagejpeg()
22 */
23 class QRGdImageJPEG extends QRGdImage{
24
25 final public const MIME_TYPE = 'image/jpg';
26
27 protected function setTransparencyColor():int{
28 // noop - transparency is not supported
29 return -1;
30 }
31
32 /**
33 * @throws \chillerlan\QRCode\Output\QRCodeOutputException
34 */
35 protected function renderImage():void{
36 if(imagejpeg(image: $this->image, quality: $this->getQuality()) === false){
37 throw new QRCodeOutputException('imagejpeg() error');
38 }
39 }
40
41 }