Report this

What is the reason for this report?

PHP GD Library Image Effect not working

Posted on December 27, 2014
omg

By omg

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.



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

This question was answered by @dti:

Please note that php5-gd package is missing functions ( imageantialias, imagerotate, etc.) in Ubuntu. See https://bugs.launchpad.net/ubuntu/+source/php5/+bug/1294074

View the original comment

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.