Welcome Guest, Not a member yet? Register   Sign In
How to use Imagick with CI 4 ?
#1

Hi,

I would like to know how to use Imagick with CI 4. When I try the information on our document page I still can't activate it and the system says The framework needs the following extension(s) installed and loaded: IMAGICK.
Reply
#2

(This post was last modified: 10-31-2022, 02:08 PM by captain-sensible. Edit Reason: forgot about re-starting apache )

On the documentation you have :
Code:
$image = Config\Services::image('imagick');
//whereas the line below worked for me was

$image =\Config\Services::image('imagick');
I'm on Arch Linux , and have apache running as a web server on my PC on a "localhost" basis

in order for me to get no error for
Code:
$image =\Config\Services::image('imagick');
in a controller
working i already had ImageMagic , but then also installed php-imagick
//you might have to also install the relevant php-*magic for your PC /server

Code:
//my pkg
community/php-imagick 3.7.0-2 [installed]
    PHP extension to create and modify images using the ImageMagick library
that created /etc/php/conf.d/imagick.ini

i hen had to remove the " ;" from in front of : extension = imagick
i dont know your OS, but you might look in your relevant php.ini file and see if extension = imagick is enabled by removing ";"

On some other Linux like buntu's i think they have to actually write extension=imagick , rather than enable it.

Also to take affect i had to re-start apache using
Code:
sudo systemctl restart httpd



you might also need to enable "gd" in php.ini



Code:
i did $image =\Config\Services::image('imagick');
    var_dump($image);    
//to see what the object held and got :



object(CodeIgniter\Images\Handlers\ImageMagickHandler)#53 (12) { ["config":protected]=> object(Config\Images)#52 (3) { ["defaultHandler"]=> string(2) "gd" ["libraryPath"]=> string(15) "/usr/bin/magick" ["handlers"]=> array(2) { ["gd"]=> string(37) "CodeIgniter\Images\Handlers\GDHandler" ["imagick"]=> string(46) "CodeIgniter\Images\Handlers\ImageMagickHandler" } } ["image":protected]=> NULL ["verified":protected]=> bool(false) ["width":protected]=> int(0) ["height":protected]=> int(0) ["filePermissions":protected]=> int(420) ["xAxis":protected]=> int(0) ["yAxis":protected]=> int(0) ["masterDim":protected]=> string(4) "auto" ["textDefaults":protected]=> array(12) { ["fontPath"]=> NULL ["fontSize"]=> int(16) ["color"]=> string(6) "ffffff" ["opacity"]=> float(1) ["vAlign"]=> string(6) "bottom" ["hAlign"]=> string(6) "center" ["vOffset"]=> int(0) ["hOffset"]=> int(0) ["padding"]=> int(0) ["withShadow"]=> bool(false) ["shadowColor"]=> string(6) "000000" ["shadowOffset"]=> int(3) } ["supportTransparency":protected]=> array(2) { [0]=> int(3) [1]=> int(18) } ["resource":protected]=> NULL }
CMS CI4     I use Arch Linux by the way 

Reply
#3

(This post was last modified: 10-31-2022, 02:45 PM by kenjis.)

(10-31-2022, 09:26 AM)demyr Wrote: The framework needs the following extension(s) installed and loaded: IMAGICK.

As it is, plase install imagick extention.
https://www.php.net/manual/en/imagick.installation.php
Reply
#4

Thank you guys for the answers.

Let me ask you some other questions that are in my mind: Actually I'm happy with 'gd' for general purpose but as I need to catch the cover pages of pdf files as jpg, I need this imagick. Can I continue using both or should I completely go on with imagick? Are there any differences? Additionally, Imagick looks richer than gd and CodeIgniter comes with gd as default. Is this extra dowload (set up) necessity the reason for this default choice?
Reply
#5

ImageMagickHandler is actually a work in progress, and has preformance issues.
See https://github.com/codeigniter4/CodeIgni...ssues/6317
Reply
#6

(10-31-2022, 08:32 PM)kenjis Wrote: ImageMagickHandler is actually a work in progress and has performance issues.
See https://github.com/codeigniter4/CodeIgni...ssues/6317

Thank @kenji I was stumbled with image magic with some performance but now good to hear that you are working on it
Codeigniter First, Codeigniter Then You!!
yekrinaDigitals

Reply
#7

@luckmoshy Sorry, I just explained the current status of ImageMagickHandler.
I'm not working on it.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB