Welcome Guest, Not a member yet? Register   Sign In
How to use Imagick with CI 4 ?
#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


Messages In This Thread
How to use Imagick with CI 4 ? - by demyr - 10-31-2022, 09:26 AM
RE: How to use Imagick with CI 4 ? - by captain-sensible - 10-31-2022, 01:29 PM
RE: How to use Imagick with CI 4 ? - by kenjis - 10-31-2022, 02:44 PM
RE: How to use Imagick with CI 4 ? - by demyr - 10-31-2022, 08:26 PM
RE: How to use Imagick with CI 4 ? - by kenjis - 10-31-2022, 08:32 PM
RE: How to use Imagick with CI 4 ? - by luckmoshy - 11-01-2022, 12:26 AM
RE: How to use Imagick with CI 4 ? - by kenjis - 11-01-2022, 12:35 AM



Theme © iAndrew 2016 - Forum software by © MyBB