antonioribeiro / google2fa-qrcode

QRCode for Google2FA
MIT License
106 stars 25 forks source link

Suggestion: base64 encode svg and eps image #3

Open brandonlim-hs opened 4 years ago

brandonlim-hs commented 4 years ago

pragmarx/google2fa-laravel config mentioned support for imagemagick, svg and eps options for generating QR codes.

With ImagickImageBackEnd, the image is base64 encoded. However, with svg or eps, the image is not base64 encoded.

Suggestion: base64 encode SvgImageBackEnd and EpsImageBackEnd too, so that the returned data is consistent for all supported image renderers?

sergejostir commented 4 years ago

I can make a PR for this, but I'm not sure how to handle the result of EpsImageBackEnd.

I tried image/x-eps and image/eps as MIME type, but it doesn't show the image...

brandonlim-hs commented 4 years ago

It seems like EPS file is not a standard web image format, and thus browsers are not able to display it by default. https://stackoverflow.com/questions/53612752/google-chrome-cant-display-a-eps-file https://stackoverflow.com/questions/47167033/how-to-preview-eps-file-in-html-page

May need to convert EPS file to other standard web image formats (SVG, PNG, etc) to display it inline