0
PHPでイメージのサイズを変更しようとしています。PHPでimagecopyresampledの後にmove_uploaded_fileを作成します
しかし、私はそれに最後のディレクトリをtmp_file
ファイルを移動するmove_uploaded_file
機能を使用することができますどのようにすべてのこの仕事の後?
$image = imagecreatefromjpeg($_FILES['REG_Image']['tmp_name']);
// Target dimensions
$max_width = 1014;
$max_height = 768;
// Get current dimensions
$old_width = imagesx($image);
$old_height = imagesy($image);
if($old_width > $max_height) {
// Calculate the scaling we need to do to fit the image inside our frame
$scale = min($max_width/$old_width, $max_height/$old_height);
// Get the new dimensions
$new_width = ceil($scale*$old_width);
$new_height = ceil($scale*$old_height);
// Create new empty image
$new = imagecreatetruecolor($new_width, $new_height);
// Resize old image into new
imagecopyresampled($new, $image, 0, 0, 0, 0, $new_width, $new_height, $old_width, $old_height);
}
ありがとう:
は、ここに私のコードです。