endroid / qr-code

QR Code Generator
https://endroid.nl
MIT License
4.33k stars 721 forks source link

Remove redundant zeros from SVG files #442

Closed RobinvanderVliet closed 4 months ago

RobinvanderVliet commented 4 months ago

All those redundant zeros are kind of wasteful, they don't add anything.

My SVG file went from 27 kB to 17 kB.

Screenshot SVG file

endroid commented 4 months ago

Nice, thank you. Wasn't aware all these zeroes were added. I think you can even do this in one line rtrim($string, '0.');

RobinvanderVliet commented 4 months ago

Nice, thank you. Wasn't aware all these zeroes were added. I think you can even do this in one line rtrim($string, '0.');

I thought so at first, but that would change "10.0" to "1".

endroid commented 4 months ago

Good point, you can use tag 5.0.5