-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Bug: ImageMagickHandler throws exception without imagick extension #6297
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
Comments
It seems that the extension is actually required, as noted in that header comment:
Even though the User Guide explicitly states it is not necessary: https://codeigniter4.github.io/CodeIgniter4/libraries/images.html#initializing-the-class I'm not familiar with the "width & height accessors" but that seems to be the area of need. |
It seems these accessors are used only for testing. These methods should be CodeIgniter4/system/Images/Handlers/ImageMagickHandler.php Lines 421 to 424 in f77d6f4
CodeIgniter4/system/Images/Handlers/BaseHandler.php Lines 755 to 764 in f77d6f4
|
Definitely. I assume the If we make these |
I think so. |
Can't be worse than it already is 🤷♂️ |
Sorry, I missed this: CodeIgniter4/system/Images/Handlers/ImageMagickHandler.php Lines 315 to 324 in e92a5d0
|
It looks like we were planning to change it to use the imagick extension.
|
@blurpy Why don't you install the imagick extension? |
I guess I could. I checked the production server, and both of these return var_dump(extension_loaded('imagick'));
var_dump(class_exists(Imagick::class)); If the plan is to actually use the imagick extension then I can update my development environment. |
If the current implementation relies on the extension and we have an exception enforcing that then the straightforward thing is to change the UG to match. I'm not familiar enough with Imagick and the differences between the installation and extension to make suggestions in implementation changes. |
@kenjis Thanks, that issue with multiple calls to convert is a bit worrisome as I need scaling to be fast enough for users not to notice. And that works really well in ci3. I also have a feature request I added a few days ago in the forums: https://forum.codeigniter.com/showthread.php?tid=82610 |
PHP Version
7.4
CodeIgniter4 Version
4.2.1
CodeIgniter4 Installation Method
Composer (using
codeigniter4/appstarter
)Which operating systems have you tested for this bug?
Linux
Which server did you use?
cli-server (PHP built-in webserver)
Database
MariaDB v5.5
What happened?
I'm migrating an app from CodeIgniter 3 to 4, and when trying to use the new image library it throws an exception:
I have never installed the imagick extension with ci3, and according to the documentation it should not be required in ci4 either:
Steps to Reproduce
Having just the command line imagemagick tools installed without the imagick extension.
.env
:Expected Output
Would expect the library to load without the imagick extension installed.
Anything else?
Looking at the description in the code, it seems to agree with the documentation in that the extension is not required:
CodeIgniter4/system/Images/Handlers/ImageMagickHandler.php
Lines 22 to 24 in cee5528
However, the actual code looks for the extension and if it's not there it throws an exception in the constructor:
CodeIgniter4/system/Images/Handlers/ImageMagickHandler.php
Lines 46 to 54 in cee5528
If I comment out
throw ImageException::forMissingExtension('IMAGICK');
then the library allows me to resize an image, so the documentation seems to be correct in that the extension is not required.I have not finished migration yet, so there could be some cases that do not work though.
The text was updated successfully, but these errors were encountered: