-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Implement #69606: Support BMPs (added in GD 2.1.0) #2029
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
Conversation
We add PHP bindings for libgd's features to read and write BMP files, which are available as of libgd 2.1.0. As PHP's bundled libgd doesn't yet include the respective features of the external libgd, we add these.
Any objections to apply this PR to master? Or should it be applied to PHP 7.1+? Either way, the patch would also be a small step to sync PHP's bundled libgd. @pierrejoye, @dshafik. |
I am fine, thanks :) On Jul 29, 2016 5:03 PM, "Christoph M. Becker" notifications@github.com
|
@@ -2738,6 +2783,16 @@ PHP_FUNCTION(imagegd2) | |||
} | |||
/* }}} */ | |||
|
|||
#ifdef HAVE_GD_BMP | |||
/* {{{ proto bool imagebmp(resource im [, string filename [, int compression]]) |
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.
I think $compression should be 'boolean' here (from reading the source of gdImageBmpCtx())
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.
Good catch! Indeed $compression is treated as bool, but actually imagebmp() accepts an int. Wrt. strict_types probably _php_image_output_ctx() has to be changed to have an own ZPP for PHP_GDIMG_TYPE_BMP.
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.
Yeah originally about the "q != 0" part, I would probably have gone with something like "!!q" to let C decide on its boolean conversion value, but that should have no impact if ZPP is changed ;-)
Huge +1, so we can have a synced libgd in PHP |
@cmb69 We might also look into adding TIFF+TGA support which seems to be in libgd, at least in master. @pierrejoye I take it as those implementations are finale (TGA+TIFF)? |
I've noticed just today that the bundled libgd doesn't have TIFF support yet, so I'm already planning a respective PR. And yeah, TGA support should also be added. |
Please no tiff yet. This is still experimental, no multi page support Ok witg tga. Also please keep in mind we need simply to sync 2.2.x to 7.1 branch, with On Aug 2, 2016 10:38 PM, "Christoph M. Becker" notifications@github.com
|
Okay. :-) |
@cmb69 please fix merge conflicts, and merge into master. |
Comment on behalf of cmb at php.net: Applied via commit 500b496. |
We add PHP bindings for libgd's features to read and write BMP files, which
are available as of libgd 2.1.0.
As PHP's bundled libgd doesn't yet include the respective features of the
external libgd, we add these.