imagettftext를 사용하여 생성하고 png로 저장 한 파일을 이동하고 싶습니다. 보시다시피, 아래 코드에서 move_uploaded_file을 사용했지만 아무 소용이 없습니다. 도와주세요.업로드 된 파일 이동 PHP가 작동하지 않습니다.
TQ
// Set the content-type
header('Content-Type: image/png');
// Create the image from created image
//$im = imagecreatetruecolor(180, 180);
$im = @imagecreatefromjpeg('poloroid.jpg');
// Create some colors
$white = imagecolorallocate($im, 255, 255, 255);
$grey = imagecolorallocate($im, 128, 128, 128);
$black = imagecolorallocate($im, 0, 0, 0);
//imagefilledrectangle($im, 0, 0, 399, 29, $white);
// The text to draw
//$text = 'John...';
$fbid = $_POST["id"];
$text = $_POST["want"];
$fb_email =$_POST["email"];
$fb_name=$_POST["name"];
$uploads_dir = '/uploaded_files';
// Replace path by your own font path
$font = 'verdana.ttf';
//image file name
$name ="$fbid.png";
// Add some shadow to the text
imagettftext($im, 20, 0, 25, 126, $grey, $font, $text);
// Add the text
imagettftext($im, 20, 0, 25, 125, $black, $font, $text);
// Using imagepng() results in clearer text compared with imagejpeg()
//imagepng($im);
imagepng($im,$name,9);
move_uploaded_file($name,"$uploads_dir/$name");
imagedestroy($im);
의
rename
를 사용 : 당신이 당신의 드라이브에 저장 할 수 있습니다
는imagepng
filename
매개 변수가 오류가 발생하면'error_reporting'도 켜져 있는지 확인하십시오. –move_uploaded_file [rename] (http://php.net/manual/en/function.rename.php) –