Download the PHP package charcoal/image without Composer
On this page you can find all versions of the php package charcoal/image. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download charcoal/image
More information about charcoal/image
Files in charcoal/image
Informations about the package image
Charcoal Image
The Image package provides a consistent API for image manipulation and processing with integrations for ~GD~ (coming soon) and ImageMagick (via the PHP extension or via shell commands).
Installation
Overview
Why another PHP image libary?
Why not?. Charcoal Image has been developped and used in in-house projects for almost 10 years. It has recently been rewritten to a more modern PHP style and released under an open-source license (MIT).
The main differences between existing PHP libraries like Imagine or Intervention are:
- Effect parameters are sent as an array.
- Is it
blur($sigma, $radius)
orblur($radius, $sigma)
? - With charcoal image it's constant:
blur([ 'radius' => $radius, 'sigma' => $sigma ]);
- Is it
- It supports ImageMagick binaries
- It seems to be a pretty common setup where Imagemagick is installed on a server, but the Imagick PHP library is not.
- No external dependencies, except the tiny charcoal/factory.
Usage
Typically, the Image package is used to load an image, perform operations (called effects such as blur, resize, watermark, etc.) and write the modified image.
With setData()
All effects can be added at once in a single array.
setData()
is perfect for scenario where the effects are from a JSON configuration structure, for example.
With magic methods
All effects can also be used as methods on the image (using __call()
magic).
Chainable version
Also shown: using the ImageFactory
constructor method:
Available effects and operations are documented in the API Documentation.
Available image drivers
There are currently only 2 available drivers:
imagick
- The imagick driver use the
Imagick
PHP extension, which is build on top of imagemagick.
- The imagick driver use the
imagemagick
- The imagemagick driver uses the imagmagick binaries directly, running the operations in a separate shell process instead of directely within PHP.
- The commands
convert
,mogrify
andidentify
should be installed on the system and reachable from the PHP process.
👉 Comming soon, the
gd
driver to use PHP builtin's image capacity.
How to select a driver
There are two different ways to instantiate an Image object for a specific driver.
Directly:
With the provided ImageFactory
: