[Tutorial] How to install Imagick


  • administrators
    | 53344 points

    Installing Imagick is really pain on other systems. However, it is trivial with Laragon if you follow these below steps (works with both Apache & Nginx):

    1. Download links:
      PHP Extension (PECL):
      https://pecl.php.net/package/imagick/3.4.3RC1/windows
      Imagick Binaries & Dlls:
      http://windows.php.net/downloads/pecl/deps

    IMPORTANT: Choose the right packages (version, x86 or x64, VC, Thread Safe (TS) or Non Thread Safe (NTS)).
    Even your OS is 64-bit, you should depend on the suffix -x86 or -x64 of the PHP version to select the correct ones.
    To be more specific: if you are using php-7.0.10-Win32-VC14-x86 you should download:

    PECL:
    http://windows.php.net/downloads/pecl/releases/imagick/3.4.3RC1/php_imagick-3.4.3rc1-7.0-ts-vc14-x86.zip
    Imagick Binaries & Dlls:
    http://windows.php.net/downloads/pecl/deps/ImageMagick-6.9.3-7-vc14-x86.zip

    After downloading the right packages, the next steps are easy.

    1. Extract:
    • PECL: Extract php_imagick-3.4.3rc1-7.0-ts-vc14-x86.zip to a tmp dir, then put just php_imagick.dll to PHP Extension dir (Menu > PHP > dir:ext)
    • Imagick Binaries & Dlls: Extract ImageMagick-6.9.3-7-vc14-x86.zip to a tmp dir, then put all dlls in bin (CORE_RL_*.dll, FILTER_analyze_.dll, IM_MOD_RL_*.dll, ImageMagickObject.dll) to PHP dir (Menu > PHP > Version > dir:php-xxx-xxx)
    1. Enable:
      Just click Menu > PHP > Extensions > php_imagick.dll

    That's all forks.


  • administrators
    | 53344 points


  • administrators
    | 53344 points

    Test: Creating a PHP Logo
    Ref: http://php.net/manual/en/imagick.examples-1.php
    imagick.php

    <?php
    /* Set width and height in proportion of genuine PHP logo */
    $width = 400;
    $height = 210;
    
    /* Create an Imagick object with transparent canvas */
    $img = new Imagick();
    $img->newImage($width, $height, new ImagickPixel('transparent'));
    
    /* New ImagickDraw instance for ellipse draw */
    $draw = new ImagickDraw();
    /* Set purple fill color for ellipse */
    $draw->setFillColor('#777bb4');
    /* Set ellipse dimensions */
    $draw->ellipse($width / 2, $height / 2, $width / 2, $height / 2, 0, 360);
    /* Draw ellipse onto the canvas */
    $img->drawImage($draw);
    
    /* Reset fill color from purple to black for text (note: we are reusing ImagickDraw object) */
    $draw->setFillColor('black');
    /* Set stroke border to white color */
    $draw->setStrokeColor('white');
    /* Set stroke border thickness */
    $draw->setStrokeWidth(2);
    /* Set font kerning (negative value means that letters are closer to each other) */
    $draw->setTextKerning(-8);
    /* Set font and font size used in PHP logo */
    #$draw->setFont('Handel Gothic.ttf');
    $draw->setFontSize(150);
    /* Center text horizontally and vertically */
    $draw->setGravity(Imagick::GRAVITY_CENTER);
    
    /* Add center "php" with Y offset of -10 to canvas (inside ellipse) */
    $img->annotateImage($draw, 0, -10, 0, 'php');
    $img->setImageFormat('png');
    
    /* Set appropriate header for PNG and output the image */
    header('Content-Type: image/png');
    echo $img;
    

    Result:
    0_1484388356126_imagick-php.png


  • | 137 points

    @leokhoa

    Thanks for the tutorial. I have it up and running, but I can't seen to access it via the command line. I did a little research and it seems that the solution may be to set the $PATH for imagemagick.

    Any idea how to do that?

    Thanks,

    Moshe


  • administrators
    | 53344 points

    @MoreThinking: Instead of extracting ImageMagick-6.9.3-7-vc14-x86.zip to a tmp dir, you can extract to laragon\usr\bin and add it to PATH.


  • | 1274 points

    I am getting The program can't start because CORE_RL_wand_.dll is missing from your computer.

    It's already in C:\laragon\bin\php\php-7.0.12-Win32-VC14-x86 where my PHP is installed.

    I used your links since they should be using the same versions.


  • | 2181 points

    @leokhoa said in [Tutorial] How to install Imagick:

    After downloading the right packages, the next steps are easy.

    Extract:

    PECL: Extract php_imagick-3.4.3rc1-7.0-ts-vc14-x86.zip to a tmp dir, then put just php_imagick.dll to PHP Extension dir (Menu > PHP > dir:ext)
    Imagick Binaries & Dlls: Extract ImageMagick-6.9.3-7-vc14-x86.zip to a tmp dir, then put all dlls in bin (CORE_RL_.dll, FILTER_analyze_.dll, IM_MOD_RL_.dll, ImageMagickObject.dll) to PHP dir (Menu > PHP > Version > dir:php-xxx-xxx)

    Enable:
    Just click Menu > PHP > Extensions > php_imagick.dll

    Step 3 php should I copy the folder or folder ext?


  • administrators
    | 53344 points

    @sajjadkazemi10 : I copied to PHP dir (no ext) and it worked. So, try it.


  • | 2181 points

    @leokhoa
    I used my laragon 2.2.2 full
    I did the same thing
    But the following error shows
    Rather than point the following message dll files to the list with the same message

    warning: php startup: unable to load dynamic library 'c:/laragon/bin/php/php-7.1.5-nts-win32-vc14-x86/ext........ - the specified module colud not br found. i unknown on line 0
    php7ts.dll
    core_rl_magick.dll
    core_rl_ttf.dll
    core_rl_wand.dll
    core_rl_zlib.dll
    core_rl_lqr.dll
    core_rl_lcms.dll
    core_rl_glib.dll
    core_rl_bzlib.dll


    warnig : php startup: imgick: unable to initalize module
    module complid with module api=20151012
    php complid with module api=20160303
    these options need to match
    in known on line 0


    warinig: php startup: unable to load dynamic library 'c:/laragon/bin/php/php-7.1.5-nts-win32-vc14-x86/ext\phar.so' - the specified module colud not br found. i unknown on line 0


  • administrators
    | 53344 points

    @sajjadkazemi10: Please provide me:

    1. A picture of your PHP dir
    2. Which Imagick package did you download?
      If you use PHP-7.1.5 nts x86, the package should be:
      http://windows.php.net/downloads/pecl/releases/imagick/3.4.3RC1/php_imagick-3.4.3rc1-7.1-nts-vc14-x86.zip

  • | 2181 points

    @leokhoa
    The message appears only

    warning: php startup: unable to load dynamic library 'c:/laragon/bin/php/php-7.1.5-nts-win32-vc14-x86/ext\php7ts.dll - the specified module colud not br found. i unknown on line 0

    warinig: php startup: unable to load dynamic library 'c:/laragon/bin/php/php-7.1.5-nts-win32-vc14-x86/ext\phar.so' - the specified module colud not br found. i unknown on line 0


  • administrators
    | 53344 points

    @sajjadkazemi10 : pls answer my questions properly


  • | 2181 points

    This post is deleted!

  • | 2181 points

    @leokhoa I email the photos to you


  • administrators
    | 53344 points

    @sajjadkazemi10 : You still don't answer this:
    Which Imagick package did you download?
    If you use PHP-7.1.5 nts x86, the package should be:
    http://windows.php.net/downloads/pecl/releases/imagick/3.4.3RC1/php_imagick-3.4.3rc1-7.1-nts-vc14-x86.zip

    I guess you download a wrong package.


  • | 2181 points

    This post is deleted!

  • | 2181 points

    @leokhoa I downloaded the package


  • | 2181 points

    @leokhoa Through software TeamViewer 12 look?


  • | 2181 points

    @leokhoa

    File php7ts.dll inside the folder php now only message I got was shown
    warinig: php startup: unable to load dynamic library 'c:/laragon/bin/php/php-7.1.5-nts-win32-vc14-x86/ext\phar.so' - the specified module colud not br found. i unknown on line 0


Log in to reply
 

Looks like your connection to Laragon was lost, please wait while we try to reconnect.