aleks_lv
Новичок
Доброй ночи.
пытаюсь наложить изображение в формате png на фон
код такой
результат такой
http://skyhelp.ru/scripts/image/image.php
png изображение такое
http://skyhelp.ru/uploads/icons/Blagodat_1.png
в чем проблема ?что не учитываю?
пытаюсь наложить изображение в формате png на фон
код такой
PHP:
if($type='icons'){
$heigth=314;
$width=1229;
$fon="#bcedfa";
$im = @imagecreatetruecolor($width, $heigth);
$rgb=hex2rgb($fon);
// установка фона
$color = imagecolorallocate($im, $rgb[0], $rgb[1], $rgb[2]);
imagefill($im, 0, 0, $color);
$m=$path_upload.$type.'/'.'Blagodat_1.png';
$png = imagecreatefrompng($m);
imagealphablending($png, false);
imagesavealpha($png, true);
list($new_width, $new_height) = getimagesize($m);
imagecopyresampled($im, $png, 0, 0, 0, 0, $new_width, $new_height, $width, $heigth);
header('Content-type: image/png');
imagepng($im);
imagedestroy($im);
}
function hex2rgb($hex) {
$hex = str_replace("#", "", $hex);
if(strlen($hex) == 3) {
$r = hexdec(substr($hex,0,1).substr($hex,0,1));
$g = hexdec(substr($hex,1,1).substr($hex,1,1));
$b = hexdec(substr($hex,2,1).substr($hex,2,1));
} else {
$r = hexdec(substr($hex,0,2));
$g = hexdec(substr($hex,2,2));
$b = hexdec(substr($hex,4,2));
}
$rgb = array($r, $g, $b);
//return implode(",", $rgb); // returns the rgb values separated by commas
return $rgb; // returns an array with the rgb values
}
http://skyhelp.ru/scripts/image/image.php
png изображение такое
http://skyhelp.ru/uploads/icons/Blagodat_1.png
в чем проблема ?что не учитываю?