Skip to content

Instantly share code, notes, and snippets.

@eplt
Last active August 15, 2023 15:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save eplt/55c4d06716badcf6b7bd9f1bbe759d18 to your computer and use it in GitHub Desktop.
Save eplt/55c4d06716badcf6b7bd9f1bbe759d18 to your computer and use it in GitHub Desktop.
Install Imagemagick with HEIC on DigitalOcean LAMP Ubuntu 20.04
#!/bin/bash
start_time="$(date -u +%s)"
sed -Ei 's/^# deb-src /deb-src /' /etc/apt/sources.list
apt-get update
apt-get -y install build-essential autoconf libtool git-core cmake
apt-get -y build-dep imagemagick libmagickcore-dev libde265 libheif
cd /usr/src/
git clone https://github.com/strukturag/libde265.git
git clone https://github.com/strukturag/libheif.git
cd libde265/
./autogen.sh
./configure
make -j$(nproc)
make install
cd /usr/src/libheif/
mkdir build
cd build
cmake --preset=release ..
make -j$(nproc)
make install
cd /usr/src/
wget https://www.imagemagick.org/download/ImageMagick.tar.gz
tar xf ImageMagick.tar.gz
cd ImageMagick-7*
./configure --with-heic=yes
make -j$(nproc)
make install
ldconfig
apt-get -y install php-imagick
cd /usr/src/
wget http://pecl.php.net/get/imagick-3.5.1.tgz
tar -xvzf imagick-3.5.1.tgz
cd imagick-3.5.1/
apt-get -y install php8.2-dev
phpize
./configure
make -j$(nproc)
make install
phpenmod imagick
systemctl restart apache2
php -r 'phpinfo();' | grep HEIC
end_time="$(date -u +%s)"
elapsed="$(($end_time-$start_time))"
echo "Total of $elapsed seconds elapsed for this script."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment