-
Notifications
You must be signed in to change notification settings - Fork 215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add GD image backend #171
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #171 +/- ##
=======================================
Coverage ? 64.93%
Complexity ? 981
=======================================
Files ? 48
Lines ? 3094
Branches ? 0
=======================================
Hits ? 2009
Misses ? 1085
Partials ? 0 ☔ View full report in Codecov by Sentry. |
README.md
Outdated
@@ -37,3 +37,21 @@ BaconQrCode comes with multiple back ends for rendering images. Currently includ | |||
- `ImagickImageBackEnd`: renders raster images using the Imagick library | |||
- `SvgImageBackEnd`: renders SVG files using XMLWriter | |||
- `EpsImageBackEnd`: renders EPS files | |||
|
|||
### GDLib Renderer | |||
GD library has so many limitations, that GD support is not added as backend, but as separated rendered. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/rendered/renderer/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
README.md
Outdated
|
||
### GDLib Renderer | ||
GD library has so many limitations, that GD support is not added as backend, but as separated rendered. | ||
Use `GDLibRendered` instead of `ImageRenderer`. Here are limitations: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/Rendered/Renderer/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, and: "These are the limitations" :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
src/Renderer/GDLibRenderer.php
Outdated
|
||
private function imageFilledPolygon(array $points, int $color): bool | ||
{ | ||
if (\PHP_VERSION_ID >= 80000) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check should not be required anymore, as we raised the minimum version to 8.1 in the next release.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
2723a0e
to
615d1f3
Compare
LGTM, thanks for your work! :) |
Copy of closed #114
My client's web hosting provider sucks, and they don't have support for Imagick, even though they are promising it will be added.
I'm generating QR codes for payment, which is added into email body. And email client's do not have nice support for SVG. So I need old-school GD support.
However, GD has limited sets of functions. I believe, that it is OK, when that Renderer will have also limited sets of features.
So this is not supported:
And because GD does not support Paths like Imagick or SVG do, I need to generate a bit different paths, so they are not so complex.
Sorry for opening new PR, but I had to change branch. I really needed the GD Renderer and in many projects I'm using this in
package.json
. Not to break them by changing commit name, I had to create new branch. But then it is not possible to change source branch in PR.