Fixed resizing
This commit is contained in:
parent
bdd04ce292
commit
71036ba85f
1 changed files with 5 additions and 2 deletions
|
@ -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))
|
||||||
;
|
;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue