PHP Image resizeは黒の背景のみを返します。Image Resizeは黒の背景を返します
私はここですべての同様の記事を読みましたが、いずれも私の問題を解決しませんでした。ここで
コードです:
$namef = $_FILES['image']['name'];
$tmp_name = $_FILES['image']['tmp_name'];
$src = imagecreatefromjpeg($tmp_name);
$location = "../userpictures/standard/".$mdid.".".$mzad;
move_uploaded_file($tmp_name, $location);
list($width, $height, $type, $att) = getimagesize($location);
$newwidth = 200;
$newheight=($height/$width)*$newwidth;
$tmp=imagecreatetruecolor($newwidth,$newheight);
imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,
$width,$height);
$locations = "../userpictures/medium/".$mdid.".".$mzad;
imagejpeg($tmp,$locations,100);
move_uploaded_file($tmp_name, $location);
私は、このコードは、PHPチュートリアルで有効だった、それがコードでOKだったかどうかをチェックしました。
透過性を持つgifファイルに黒い背景がありますが、jpgは問題ありませんか? – Cheery
私はgifファイルを許可しません。唯一のjpg。だからjpgには透明度がない –