Php在图像上写文本,保存选项


Php Write Text on the Image, SAVE OPTION

好吧,这就是我现在所拥有的。

$bg = imagecreatefrompng('bg.png');
$font = "font.ttf";
$white = imagecolorallocate($bg, 255, 255, 255);
header("Content-type: image/png");
imagettftext($bg, 25, 0, 5, 83, $white, $font, date('d.m.Y'));
imagettftext($bg, 30, 0, 5, 145, $white, $font, date('H:i'));
imagepng($bg);
imagedestroy($bg);

我想知道如何才能真正保存创建的图像。我试着做这样的事情:

imagepng($bg,"/users/user/");

保存是但根本不起作用。有人能告诉我如何保存图片吗?

谢谢。

尝试一下:

imagepng($bg, "/users/user/bg.png");
imagedestroy($bg);