Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Alex Vanderbist:
Fixing Imagick's “not authorized” exception
Nov 07, 2018 @ 16:48:40

Alex Vanderbist has a recent post to his site showing how to fix an issue with Imagick and the "not authorized" exception that can happen when processing PDF files.

Over the last few days we've had a couple of issues with Imagick and processing PDFs on our servers. As it turns out, these issues are caused by automatic security updates. Let's look into the issue and its solution.

The post starts with an example of the errors they've been seeing with the "not authorized" message in their Bugsnag logs. As they traced the problem they saw it was happening on older codebases too, not just new ones. Finally they tracked down the culprit: a recent security update to Imagick that added extra policies for PDFs that need to be configured for it to work as before. They provide an example of what should be added to your policy.xml file and how to bulk-patch your systems via Ansible.

tagged: tutorial processing pdf imagick policy fix

Link: https://alexvanderbist.com/posts/2018/fixing-imagick-error-unauthorized

Mikko Koppanen:
Working on images asynchronously
Dec 16, 2013 @ 16:45:35

Mikko Koppanen has a new post to his site today about working with images asynchronously - the "offline" processing of things like user uploaded images using a queuing system.

To get my quota on buzzwords for the day we are going to look at using ZeroMQ and Imagick to create a simple asynchronous image processing system. Why asynchronous? First of all, separating the image handling from a interactive PHP scripts allows us to scale the image processing separately from the web heads. [...] Secondly, separating the image processing from a web script can provide more responsive experience to the user. This doesn’t necessarily mean faster, but let’s say in a multiple image upload scenario this method allows the user to do something else on the site while we process the images in the background.

He also includes a "barebones" example of how the system would work. The first Worker script makes the connection to the queue system and sends the data off for handling. The second script does most of the actual work, pulling in the image and using Imagick to create a thumbnail image. Finally he includes an example of the use of the workers in combination to send the image data for processing.

tagged: image asynchronous processing zeromq thumbnail imagick

Link: http://valokuva.org/working-on-images-asynchronously/

SitePoint PHP Blog:
Imagick vs GD
Nov 29, 2013 @ 00:16:34

In a new post to the SitePoint PHP blog Jacek Barecki has written up a comparison of two of the most widely used PHP image manipulation libraries - Imagick and GD.

If you want to create a thumbnail, apply a filter to an image or transform it in any other way, you will have to employ an image processing library in your PHP application. It means that you will probably choose GD or ImageMagick. But which one supports a wider range of image formats? Maybe one of them is slower than the other? What other criteria should be taken under consideration when choosing the right library?

He compares them on a few different aspects:

  • Availability
  • Supported file types
  • Functionality
  • Performance
  • Coding style
  • Popularity

He also provides three alternatives to using GD or Imagick, most involving outside services or software.

tagged: imagick gd image manipulation library tutorial

Link: http://www.sitepoint.com/imagick-vs-gd/

Mikko Koppanen:
Imagick Refresh Updates
Oct 07, 2013 @ 14:21:50

Mikko Koppanen has been posted several new items about the updates being made to the Imagick functionality in PHP (added as a PECL extension). In order o posting they are:

The Imagick extension is a more advanced image manipulation library that the built-in GD functionality. You can find out more about the functions and features it offers in its manual page.

tagged: imagick graphics manipulation update bugfix

Link: http://valokuva.org/

PHPMaster.com:
Adding Text Watermarks with Imagick
Dec 31, 2012 @ 15:15:48

On PHPMaster.com there's a recent tutorial from Martin Psinas about how you can add text to an image with the help of Imagick, the image editing software that's available to PHP via an extension.

In a previous article, Timothy Boronczyk wrote about how to create watermarks with Imagick using an overlay image. In this article, I’ll show you how to achieve a similar effect using plain text.

He takes a sample image (a headshot) and offers two versions of the same functionality - both the shell command (using "convert") and the PHP code that sets up the font to use, adds placement and pushes the result back out as a PNG. He also includes two other types of overlay - a font mask for a more see-through look and a tiled version, overlaying the text all over the image.

tagged: watermark imagick tutorial text overlay mask tile

Link:

Bob Majdak's Blog:
Making images transparent using Imagick - enter the pixel iterator
Jul 16, 2012 @ 13:35:37

In this recent post to his blog Bob Majdak looks at how to use the Imagick functionality to create images with transparent backgrounds.

So we have this image, and we want to set it to be 75% transparent using Imagick. This sounds simple enough, doesn't it? Perhaps we are trying to create a watermark, or we just want to fade the image for some reason.

He shows how to use the ImagickPixelIterator to take care of some of the issues that can be caused by just a call to "setImageOpacity". A code sample is included in the post showing how to take a source image and make it transparent without ending up with a white border/black background like the other version.

tagged: imagick transparent pixeliterator tutorial transparent

Link:

James Morris' Blog:
How to Strip EXIF Data Using Imagick
Aug 25, 2011 @ 15:42:33

James Morris has a quick tutorial today showing how to pull the exif data from a photo and make it into something useful you can either display on on the site or store for categorization.

Today I spent a good amount of time trying to figure out how to strip exif data from an image using Imagick. The first port of call was the (pathetic) documentation at php.net. I searched for 'exif' but found nothing. [...] I was tipped off by a colleague to the method Imagick::stripImage() which apparently did what I wanted. The only mention of exif is in a rather helpful comment at the bottom of the page.

This comment pointed him to the Imagick::stripImage() function that pulls off the data and returns exif information (or, as the documentation calls it, "profiles and comments"). His seven line script is included in the post that initializes the Imagick object, pulls in the file and runs the stripImage() method with the option for "exif:*". The resulting properties are then displayed including aperature value, date taken, exposure time, make and model of the camera, shutter speed, resolution and much more.

tagged: tutorial image exif data imagick stripimage

Link:

Lars Strojny's Blog:
PHP Segfaulting with PECL/UUID and PECL/IMAGICK
Sep 08, 2010 @ 19:17:13

If you've been using (or will be using) the uuid and imagick extensions for PHP, you might be able to save yourself a lot of headache by reading this new post from Lars Strojny about his segfault woes.

Ran into a bug yesterday, where http://pecl.php.net/uuid in combination with http://pecl.php.net/imagick yielded a segfault when using uuid_create().

After trying to trace it down with a backtrace and cachegrind results, he (and Mikko & Pierre) found that both extensions were built against the libuuid.so.1 file. While that wasn't the issue directly, they did find a work-around that helped the issue - renaming some ini files so uuid was loaded first.

tagged: uuid imagick pecl extension segfault debug libuuid

Link:

Jeremy Cook's Blog:
Installing Imagick under Apache on Windows
Jun 08, 2010 @ 17:48:38

Jeremy Cook has put together a guide for installing Imagick on Windows so it can be used in your PHP applications..

After a few weeks of experimenting on and off I've just managed to get the Imagick extension installed under Apache on Windows (my development environment). While discovering how to make it work was not at all simple the final process of getting all the pieces to play together nicely was pretty easy. In this post I'll briefly discuss what ImageMagick and the Imagick extension for PHP are, why you might want to use them, how I got them up and running and finally a very simple piece of example code. I'm hoping this post will help people avoid the frustration and effort I went through to get them to work!

He explains what the tools (ImageMagick & Imagick) are and why it's a bit more difficult to install them on Windows than just a point and click sort of thing. He walks you through an eight-step process that will have you up and working in no time and includes a simple PHP script you can run to ensure things are working as they should.

tagged: windows imagick install tutorial image manipulate

Link:

Mikko Koppanen's Blog:
Imagick and Gmagick builds available for Windows
Sep 22, 2009 @ 16:26:27

Mikko Koppanen has a quick post about the latest Windows binary releases of two graphics packages for use with PHP 5.3 - Imagick and Gmagick.

The new Windows build page http://valokuva.org/magick/ contains builds for both Imagick and Gmagick. All builds are done using VC9 and PHP 5.3. ImageMagick builds are QuantumDepth 16 (default). GraphicsMagick builds are QuantumDepth 8 (default).

You can find these latest builds on the Windows PHP.net site along with the latest PHP 5.3 builds.

tagged: imagick gmagick build windows

Link:


Trending Topics: