Issue
I have created a website http://www.example.com and i want to change color of its widget using PHP GD.
lets widget URL is www.example.com/widget.gif
When I pass hexadecimal value to this URL it should change colour like
www.example.com/widget.gif?bg=#CC66CC
Solution
Try the following code
Give your color code in gd function IMG_FILTER_COLORIZE
$imgname = "source.png";
$im = imagecreatefrompng ($imgname);
if($im && imagefilter($im, IMG_FILTER_COLORIZE, 137, 113, 79))
{
echo 'Image successfully shaded green.';
imagepng($im, 'result.png');
imagedestroy($im);
}
else
{
echo 'Green shading failed.';
}
Answered By - Hardik Raval Answer Checked By - Marie Seifert (PHPFixing Admin)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.