이미 서버에 업로드 된 이미지에서 새 이미지를 만듭니다. 새 이미지를 내 서버의 다른 폴더에 업로드하고 싶습니다. 아래 코드로 이미지를 만듭니다. 어떻게 $ jpg_image를 폴더에 업로드 할 수 있습니까?imagecreatefromjpeg에서 만든 이미지를 서버로 업로드하려면 어떻게해야합니까?
<?php
$myu="a";
$time = time();
$ip=$_SERVER['REMOTE_ADDR'];
$hour= date("H");
$minute =date("i");
$day = date("d");
$month = date("m");
$year = date("Y");
$mysex =$_SESSION['se'];
$cappic = $_POST['cappic'];
$usttxt = $_POST['ust'];
$alttxt = $_POST['alt'];
$altfont = $_POST['altfont'];
$ustfont = $_POST['ustfont'];
// Create Image From Existing File
$jpg_image = imagecreatefromjpeg("image.jpg");
list($width, $height) = getimagesize("image.jpg");
// Allocate A Color For The Text
$white = imagecolorallocate($jpg_image, 255, 255, 255);
$color2 = imagecolorallocate($jpg_image, 0, 0, 0);
// Set Path to Font File
$font_path = 'impact.ttf';
// Set Text to Be Printed On Image
$text = $usttxt;
$fs = $ustfont;
$dimensions = imagettfbbox($fs, 0, $font_path, $text);
$loc1 = $width-$dimensions[2];
$loc1 = $loc1/2;
$bot= $fs+10;
// Print Text On Image
imagettftext($jpg_image, $fs, 0, $loc1, $bot+2, $color2, $font_path, $text);
imagettftext($jpg_image, $fs, 0, $loc1, $bot-2, $color2, $font_path, $text);
imagettftext($jpg_image, $fs, 0, $loc1-2, $bot, $color2, $font_path, $text);
imagettftext($jpg_image, $fs, 0, $loc1+2, $bot, $color2, $font_path, $text);
imagettftext($jpg_image, $fs, 0, $loc1, $bot, $white, $font_path, $text);
$text2 = $alttxt;
$fs = $altfont;
$dimensions2 = imagettfbbox($fs, 0, $font_path, $text2);
$loc2 = $width-$dimensions2[2];
$loc2 = $loc2/2;
$bot=$height-20;
// Print Text On Image
imagettftext($jpg_image, $fs, 0, $loc2, $bot+2, $color2, $font_path, $text2);
imagettftext($jpg_image, $fs, 0, $loc2, $bot-2, $color2, $font_path, $text2);
imagettftext($jpg_image, $fs, 0, $loc2-2, $bot, $color2, $font_path, $text2);
imagettftext($jpg_image, $fs, 0, $loc2+2, $bot, $color2, $font_path, $text2);
imagettftext($jpg_image, $fs, 0, $loc2, $bot, $white, $font_path, $text2);
// Send Image to Browser
imagejpeg($jpg_image);
imagedestroy($jpg_image);
// Clear Memory
?>
[복사] (http://php.net/manual/en/function.copy.php)? –
copy ($ jpg_image, "/ upload_folder/aaa.jpg")를 시도했지만 작동하지 않았습니다. 어쩌면 내가 뭔가 잘못한거야? –
리소스가 아닌 원본 _filename_ 이미지를 넣어야합니다. –