1
0
Fork 0
mirror of synced 2024-09-30 01:08:13 +13:00

Fixed resizing

This commit is contained in:
Eldad Fux 2021-01-10 02:17:44 +02:00
parent bdd04ce292
commit 71036ba85f

View file

@ -386,7 +386,6 @@ App::get('/v1/avatars/qr')
'addQuietzone' => true, 'addQuietzone' => true,
'quietzoneSize' => $margin, 'quietzoneSize' => $margin,
'outputType' => QRCode::OUTPUT_IMAGICK, 'outputType' => QRCode::OUTPUT_IMAGICK,
'pngCompression' => 9,
]); ]);
$qrcode = new QRCode($options); $qrcode = new QRCode($options);
@ -395,10 +394,14 @@ App::get('/v1/avatars/qr')
$response->addHeader('Content-Disposition', 'attachment; filename="qr.png"'); $response->addHeader('Content-Disposition', 'attachment; filename="qr.png"');
} }
$resize = new Resize($qrcode->render($text));
$resize->crop((int) $size, (int) $size);
$response $response
->addHeader('Expires', \date('D, d M Y H:i:s', \time() + (60 * 60 * 24 * 45)).' GMT') // 45 days cache ->addHeader('Expires', \date('D, d M Y H:i:s', \time() + (60 * 60 * 24 * 45)).' GMT') // 45 days cache
->setContentType('image/png') ->setContentType('image/png')
->send($qrcode->render($text)) ->send($resize->output('png', 9))
; ;
}); });