PHP GD Library Image Effect not working

December 27, 2014 1.7k views

I am using a fresh LEMP Ubuntu 14.04 server with PHP Version 5.5.9. The version of the GD Library I'm uisng is 2.1.1-dev.

I am trying to use this function:

imagelayereffect($emblem, IMG_EFFECT_OVERLAY);

Here is my GD Library functions:

Function [ <internal:gd> function imagelayereffect ] {

My code for overlaying the banner is:

$emblem = imagecreatefrompng($emblemURL);
    $emblem_size = getimagesize($emblemURL);
    imagelayereffect($emblem, IMG_EFFECT_OVERLAY);
    $emblemcolor = preg_replace('/^ff/i', '', $guild['emblem']['iconColor']);
    $color_r = hexdec(substr($emblemcolor, 0, 2));
    $color_g = hexdec(substr($emblemcolor, 2, 2));
    $color_b = hexdec(substr($emblemcolor, 4, 2));
    imagefilledrectangle($emblem, 0, 0, $emblem_size[0], $emblem_size[1], imagecolorallocatealpha($emblem, $color_r, $color_g, $color_b, 0));

The image I am trying to overlay is this: image 1. As you can see it overlays a square of brown and is not blending at all. I have also tried to do the example image in the PHP documentation on how to use imagelayereffect and got this result: image 2

I have changed Operating Systems to CentOS to see if that would make a difference, and it worked perfectly. I'm not sure what is wrong here or what I'm doing wrong, as I have researched a lot of this and cannot find a direct answer.

If anybody could shed some light on this it would be highly appreciated.

1 comment
1 Answer

This question was answered by @dti:

Please note that php5-gd package is missing functions ( imageantialias, imagerotate, etc.) in Ubuntu. See

View the original comment

Have another answer? Share your knowledge.