mam taką funkcję:
<?php
switch($typ_pliku)
{
case 'image/jpeg':
$pref_gd = "jpeg";
break;
case 'image/png':
$pref_gd = "png";
break;
case 'image/pjpeg':
$pref_gd = "jpg";
break;
case 'image/gif':
$pref_gd = "gif";
break;
}
$width = $size[0];
$height = $size[1];
$x_ratio = $max_width / $width;
$y_ratio = $max_height / $height;
if(($width <= $max_width) && ($height <= $max_height))
{
$tn_width = $width;
$tn_height = $height;
}
else if(($x_ratio * $height) < $max_height)
{
$tn_height = ceil($x_ratio * $height); $tn_width = $max_width;
}
else
{
$tn_width = ceil($y_ratio * $width); $tn_height = $max_height;
}
$func_plus_prefix_1 = "imagecreatefrom".$pref_gd;
$func_plus_prefix_2 = "image".$pref_gd;
$src = @$func_plus_prefix_1($file);
$dst = imagecreatetruecolor($tn_width, $tn_height);
@imagecopyresampled($dst, $src, 0, 0, 0, 0, $tn_width, $tn_height, $width, $height);
if($typ_pliku == 'image/png')
{
if(@imagepng($dst, $katalog.'/'.$name))
return true;
}
else
{
if(@$func_plus_prefix_2($dst, $katalog.'/'.$name, $jakosc))
return true;
}
?>
i mój problem polega na tym że pliki png mają czarne tło jak są przeźroczyste, a wiem ze powinno być przeźroczyste albo białe