Closed dgsiegel closed 2 years ago
As described in the docs, I added the following to site/templates/default.qr.php
site/templates/default.qr.php
$page->qrcode()->download( $page->slug() . '.png' );
The problem is that the content type will still be set to text/html and hence the download dialog will behave strangely.
text/html
This can also be confirmed via curl:
HTTP/1.1 200 OK Host: localhost:8080 Date: Tue, 15 Feb 2022 11:07:28 GMT Connection: close X-Powered-By: PHP/8.0.15 Pragma: public Last-Modified: Tue, 15 Feb 2022 11:07:28 GMT Content-Disposition: attachment; filename="default.png" Content-Transfer-Encoding: binary Connection: close Cache-Control: no-store Content-Type:text/html; charset=UTF-8
Changing the template to
$page->qrcode()->download( $page->slug() . '.png' ); exit;
will in fact give you the correct content type:
HTTP/1.1 200 OK Host: localhost:8080 Date: Tue, 15 Feb 2022 11:05:08 GMT Connection: close X-Powered-By: PHP/8.0.15 Pragma: public Cache-Control: no-cache, no-store, must-revalidate Last-Modified: Tue, 15 Feb 2022 11:05:08 GMT Content-Disposition: attachment; filename="default.png" Content-Transfer-Encoding: binary Content-type: image/png; charset=UTF-8 Connection: close
Thanks!
As described in the docs, I added the following to
site/templates/default.qr.php
The problem is that the content type will still be set to
text/html
and hence the download dialog will behave strangely.This can also be confirmed via curl:
Changing the template to
will in fact give you the correct content type: