Skip to content
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

GMagick No encode delegate for this image format #732

Closed
ausi opened this issue Dec 19, 2019 · 3 comments · Fixed by #750
Closed

GMagick No encode delegate for this image format #732

ausi opened this issue Dec 19, 2019 · 3 comments · Fixed by #750

Comments

@ausi
Copy link
Contributor

ausi commented Dec 19, 2019

Issue description

On my system it is not possible to save a GMagick image to a file without a file extension. The Exception No encode delegate for this image format (jpeg) gets thrown.

What's the PHP version you are using?

7.3.13-1+ubuntu16.04.1+deb.sury.org+1

What's the imaging library you are using [gd/imagick/gmagick/any]?

GMagick

What's the imaging library configuration

gmagick version => 2.0.5RC1
GraphicsMagick version => GraphicsMagick 1.4 snapshot-20180922 Q16 http://www.GraphicsMagick.org/

Minimal PHP code to reproduce the error:

$gmagick = new \Gmagick();
$gmagick->newimage(100, 100, (new \GmagickPixel('#ffffff'))->getcolor(false));
$gmagick->setimageformat('jpeg');
$gmagick->writeimage(__DIR__.'/testimage');

How to fix

The GraphicsMagick documentation shows the image format in uppercase ("GIF") and if I replace the 'jpeg' with 'JPEG' in the test code above this fixes the issue for me.

I think we should replace https://github.com/avalanche123/Imagine/blob/3db069bd870f45b5305e7d6bd4e08d45ebb22cef/src/Gmagick/Image.php#L433 with:

$this->gmagick->setimageformat(strtoupper($options['format']));
@ausi
Copy link
Contributor Author

ausi commented Jan 15, 2020

@mlocati should I provide a pull request for the fix?

@mlocati
Copy link
Collaborator

mlocati commented Jan 15, 2020

@ausi that'd be great

@ausi
Copy link
Contributor Author

ausi commented Jan 15, 2020

Pull request: #733

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants