Imagick (ImageMagick PHP Extension) For ePaper CMS

:puzzle_piece: What are Ghostscript and Imagick, and Why Are They Required?

:page_facing_up: Ghostscript

Ghostscript is a suite of software that provides an interpreter for the PostScript language and for PDF files. It allows your server to convert, view, or print PDFs and PostScript files.

:small_blue_diamond: Why it’s needed:
Ghostscript is essential if your application handles PDF files — especially for generating thumbnails, converting pages to images (e.g., JPG/PNG), or printing.


:framed_picture: Imagick (ImageMagick PHP Extension)

Imagick is a PHP extension that acts as a wrapper for the ImageMagick library. It allows PHP scripts to create, edit, and convert images in various formats (JPG, PNG, TIFF, PDF, etc.).

:small_blue_diamond: Why it’s needed:
Imagick is used for image manipulation, such as:

  • Resizing images
  • Creating thumbnails
  • Converting PDF to image
  • Adding watermarks
  • Rotating or cropping pages

:hammer_and_wrench: How to Install Ghostscript and Imagick

:penguin: For Ubuntu/Debian:

bash

CopyEdit

apt update
apt install ghostscript imagemagick php-imagick -y

:penguin: For CentOS/AlmaLinux/RHEL:

bash

CopyEdit

yum install ghostscript ImageMagick ImageMagick-devel -y
yum install php-pecl-imagick -y

:warning: After installing, don’t forget to restart the web server:

bash

CopyEdit

systemctl restart lsws   # for LiteSpeed

:white_check_mark: How to Check if Installed

You can verify both installations like this:

:magnifying_glass_tilted_left: Check Ghostscript:

bash

CopyEdit

gs --version

:magnifying_glass_tilted_left: Check Imagick in PHP:

Create a PHP file (phpinfo.php) with:

php

CopyEdit

<?php phpinfo(); ?>

Open it in your browser and search for “imagick”. If it’s installed, you’ll see a section for it.