elementor / lokl

Instant WordPress local development for Mac, Win & Linux
https://lokl.dev
71 stars 10 forks source link

Adding php-imagick #31

Open fazalfarhan01 opened 3 years ago

fazalfarhan01 commented 3 years ago

Request to add PHP module ImageMagick

leonstafford commented 3 years ago

Thanks for suggesting, @fazalfarhan01, happy to add!

As it will still be a little time until I get to this, if you'd like to do some testing of how to do it, you can SSH into your Lokl website, via the option in the CLI wizard.

The environment is Alpine Linux, so package management is done via the apk command, if I recall correctly.

So, something like this may work: apk add imagemagick. There may be some other dependencies that it requires to be installed in a similar way. I haven't used any image stuff in PHP for a long time, so unsure if it will need extra work, like enabling an extension in an .ini file somewhere.

No need to try this if you don't want to, these will serve as notes for me when I am able to focus attention on it :D

leonstafford commented 3 years ago

Hi @fazalfarhan01,

Sorry for late reply.

So, I've done some playing around and am now seeing ImageMagick installed OK in the PHP 7 version I'm testing in:

/usr/html # php -i | grep imag
/etc/php7/conf.d/imagick.ini
imagick
imagick module => enabled
imagick module version => 3.4.4
imagick classes => Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator, ImagickKernel
Imagick compiled with ImageMagick version => ImageMagick 7.0.11-3 Q16 aarch64 2021-03-06 https://imagemagick.org
Imagick using ImageMagick library version => ImageMagick 7.0.11-9 Q16 aarch64 2021-04-24 https://imagemagick.org
imagick.locale_fix => 0 => 0
imagick.progress_monitor => 0 => 0
imagick.skip_version_check => 0 => 0

Noting some of my steps to get it working from within running container:

git clone https://github.com/Imagick/imagick
cd imagick
apk add php7-dev gcc g++ imagemagic-dev
phpize && ./configure
make
make install
cd ../
rm -rf imagick
apk add php7-imagick

some of those steps likely redundant, can test further. I'll put this on hold for a while, as I'd like parity between the php 7 and 8 versions if possible, but give that a try within your php 7 container if you can and let me know if that allows you to use it from your WP app

fazalfarhan01 commented 3 years ago

Sure thing. I'll give it a try and reach back.

leonstafford commented 3 years ago

should have been imagemagick-dev in above example, with the k

leonstafford commented 3 years ago

WIP with last commits. PHP8 process diverged from 7 for this, using pecl, needing to symlink some php8- commands.

May be able to now use pecl for both php7 and 8 and save some steps for Image Magick, at least

leonstafford commented 3 years ago

looks good in latest branches. Will be in next release