SOLUTION - How to show a png image with transparent background using Imagick in PHP

How to show a png image with transparent background using Imagick in PHP

Hello super joomlers!

After searching the web, the official website, php documentation and forums, I found, at last, the solution thanks to a friend's suggestion : "What if it was just the image background?"

Sure enough, by analysing the code of Imagick library using my favourite PHP IDE PhpStorm, I discovered the right method to call just after the Imagick constructor. Here is some sample code.

 $image = new Imagick('example.png'); 
$image->setImageAlphaChannel(Imagick::ALPHACHANNEL_ACTIVATE);

It's your turn now! Happy coding!

Alexandre ELISÉ

Développeur #PHP spécialiste #Joomla! s'intéresse aux #webservices #acl et aux #customfields. En résumé, c'est faire communiquer votre site web Joomla! avec des applications externes de façon sécurisée.

Get the newsletter

Super Joomlers! Get the most out of Joomla!
We hate spam as much as you do and we will not send you email without your prior consent. You can unsubscribe / resubscribe any time you want.