PHP GD image filter


 

PHP GD image filter

This example shows how to filter an image in php gd.

This example shows how to filter an image in php gd.

<?php

$logo1 = imagecreatefromjpeg('images.jpg');

$logo2 = imagecreatefromjpeg('images.jpg');

$output = imagecreatetruecolor(imagesx($logo1) * 2, imagesy($logo1));

imagefilter($logo1, IMG_FILTER_PIXELATE, 3);

imagefilter($logo2, IMG_FILTER_PIXELATE, 3, true);

imagecopy($output, $logo1, 0, 0, 0, 0, imagesx($logo1) - 1, imagesy($logo1) - 1);

imagecopy($output, $logo2, imagesx($logo2), 0, 0, 0, imagesx($logo2) - 1, imagesy($logo2) - 1);

imagedestroy($logo1);

imagedestroy($logo2);

header('Content-Type: image/jpeg');

imagejpeg($output);

imagedestroy($output);

?>

After running the program you will get the following output

Ads