You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.2 KiB
55 lines
1.2 KiB
<?php
|
|
|
|
require_once dirname (__FILE__) . "/../config.php";
|
|
require_once LIBDIR . "errException.php";
|
|
|
|
setErrExceptionMapping ();
|
|
|
|
// --- Data ----------------------------------
|
|
if (isset ($_REQUEST['img']))
|
|
$img = $_REQUEST['img'];
|
|
else
|
|
$img = -1;
|
|
|
|
if (isset ($_REQUEST['col']))
|
|
$col = $_REQUEST['col'];
|
|
else
|
|
$col = 'aaaaaa';
|
|
// -------------------------------------------
|
|
|
|
// Load Image and get it's size
|
|
if ($img !== -1)
|
|
{
|
|
$size = getimagesize(IMGDIR . $img);
|
|
$width = $size[0];
|
|
$height = $size[1];
|
|
unset ($size);
|
|
$loadIm = imagecreatefrompng (IMGDIR . $img);
|
|
}
|
|
else
|
|
{
|
|
$width = 1;
|
|
$height = 1;
|
|
$loadIm = imagecreatetruecolor ($width, $height);
|
|
$color = imagecolorallocatealpha ($loadIm, 0, 0, 0, 127);
|
|
imagefill ($loadIm, 0, 0, $color);
|
|
unset ($color);
|
|
}
|
|
imagealphablending ($loadIm, TRUE);
|
|
|
|
$bgImg = imagecreatetruecolor ($width, $height);
|
|
preg_match_all ('/[A-Za-z0-9]{2,2}/', $col, $rgb);
|
|
$color = imagecolorallocate (
|
|
$bgImg, hexdec ($rgb[0][0]), hexdec ($rgb[0][1]), hexdec ($rgb[0][2]));
|
|
imagefill ($bgImg, 0, 0, $color);
|
|
unset ($color);
|
|
|
|
imagecopy ($bgImg, $loadIm, 0, 0, 0, 0, $width, $height);
|
|
imagedestroy($loadIm);
|
|
|
|
resetErrExceptionMapping ();
|
|
|
|
header ("Content-Type: image/png");
|
|
imagepng ($bgImg);
|
|
|
|
?>
|