phalcon / cphalcon

High performance, full-stack PHP framework delivered as a C extension.
https://phalcon.io
BSD 3-Clause "New" or "Revised" License
10.76k stars 1.96k forks source link

[BUG]: GD with enabled webp support, but still return error #15977

Closed borisdelev closed 1 year ago

borisdelev commented 2 years ago

Description My PHP GD configuration support webp image format. I test it with simple imagecreatefromwebp function and it worked. But when use \Phalcon\Image\Adapter\Gd- i've got "Installed GD does not support image/webp images" error

PHP Windows 11, PHP 8.0.15 with Phalcon 5.0.0 Alpha 6 (but i tried it with RC- same error) image

To Reproduce Just use next line:

new \Phalcon\Image\Adapter\Gd($path_to_webp_example_file);

Expected behavior Well... to manipulate webp format images

Details

Finish Well- that's it. Maybe i am wrong somewhere or it is not a bug (it is a feature :), but i want to fix so... you are my hope :) THANK YOU all Phalcon supporters. Wish u luck and... may the force be with you!

Jeckerson commented 2 years ago

Well, as you are using alpha6, my suggest is to try RC1, and see if problem persists. but you will probably need to adjust some of code inside your project due namespace changes.

niden commented 2 years ago

It is probably the GD in the system that is not recognized by Phalcon. There is no reason why imagecreatefromwebp works in a plain php script and does not in Phalcon

I will see if I can create a failing test.

borisdelev commented 2 years ago

Well, as you are using alpha6, my suggest is to try RC1, and see if problem persists. but you will probably need to adjust some of code inside your project due namespace changes.

yeah, i tried in RC1 too, same error

I tried like this:

$im = imagecreatefromwebp($path_to_webp_example_file);
imagejpeg($im, $path_to_jpg_file, 100);
imagedestroy($im);

$image = new \Phalcon\Image\Adapter\Gd($path_to_webp_example_file); // Error here

PS: i've manage to use original PHP GD function and resize/crop webp image format and create fallback to my project... but its good to fix that for the final 5 :) Thanks guys. You are the best!

niden commented 2 years ago

@borisdelev I found where the issue lies.....

The Gd adapter does not support webp images. I thought it did but I was reading the wbmp method.

I wrote a couple of tests and will see if I can get this in the next version.

borisdelev commented 2 years ago

Like i said before- u are the best 😊

niden commented 2 years ago

Resolved in https://github.com/phalcon/cphalcon/pull/15989

borisdelev commented 2 years ago

Hi hi hi... something strange... when i try to save webp image... I am with Phalcon 5.0.0RC3 Phalcon\Image\Exception: Installed GD does not support 'webp' images

But in info file: image

Sorry to bother you @niden , but can u just check that?

niden commented 2 years ago

Issue has not been resolved in RC3.

niden commented 1 year ago

Resolved in https://github.com/phalcon/cphalcon/pull/16044

niden commented 1 year ago

@borisdelev I believe it is fixed for good now :)