写真のサイズ変更などに作成したこの関数を使用します
<?php function
> resizer($ruta_img_ini,$ruta_img_save,$name_img,$name_end,$w,$h,$quality,$redimensaionar)
> { list($w_orig, $h_orig) =
> getimagesize("".$ruta_img_ini."".$name_img."");
>
> if ($redimensaionar=="si") {
>
> $scale_ratio = $w_orig / $h_orig; if (($w / $h) > $scale_ratio) { $w =
> $h * $scale_ratio; } else { $h = $w / $scale_ratio; } } $img = "";
>
> $exp_ext=explode(".",$name_img);
>
> $ext = strtolower($exp_ext[1]);
>
> $target="".$ruta_img_ini."".$name_img."";
>
> if ($ext == "gif"){ $img = imagecreatefromgif($target); } else
> if($ext =="png"){ $img = imagecreatefrompng($target);
>
>
> imagealphablending($img, false); imagesavealpha($img,true);
> $transparent = imagecolorallocatealpha($img, 255,255,255, 127);
> imagefilledrectangle($img, 0, 0, $w, $h, $transparent);
> imagefilledrectangle($img, 2, 2, $w-4, $h-4, $transparent);
>
>
> } else { $img = imagecreatefromjpeg($target); } $tci =
> imagecreatetruecolor($w, $h); // imagecopyresampled(dst_img, src_img,
> dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h)
> imagecopyresampled($tci, $img, 0, 0, 0, 0, $w, $h, $w_orig, $h_orig);
> imagejpeg($tci, "".$ruta_img_save."".$name_end.".".$ext."", $quality);
> } ?>
問題: PNG 透過性と透過性のためのチャネル アルファ。画像のアップロードとすべては完璧ですが、アップロードすると画像が非常に黒くなり、何が起こったのかわかりません。アルファチャンネルを使用したpngの透明度を尊重しません