Php 下载生成的图像并发送到电子邮件

Php 下载生成的图像并发送到电子邮件,php,image,email,download,gd,Php,Image,Email,Download,Gd,萨拉姆 我通过向图像中添加这样的文本来生成图像 function create_image() { $im = imagecreatefrompng('coupon.png'); $red = imagecolorallocate($im, 120, 20, 20); $font = 'font/arial.ttf'; imagettftext($im, 36, 0, 176, 695, $red, $font,

萨拉姆

我通过向图像中添加这样的文本来生成图像

function create_image() 
    {

        $im = imagecreatefrompng('coupon.png');

        $red = imagecolorallocate($im, 120, 20, 20);

        $font = 'font/arial.ttf';


        imagettftext($im, 36, 0, 176, 695, $red, $font, $_POST['Tdesc']);
        ob_start();
            imagepng($im);
            $image = ob_get_contents();
        ob_end_clean();

        echo '
            <html>
                <head>
                    <title>

                    </title>
                </head>

                <body>
                    <form action="donwload.php" method="post">
                        <img src="data:image/png;base64,'.base64_encode($image).'" height="701" width="496" name="xx" />
                        <button type="submit" class="btn">Genere le coupon</button>
                    </form>
                </body>
            </html>
        ';
}
函数create_image()
{
$im=imagecreatefrompng('coupon.png');
$red=imagecolorallocate($im,120,20,20);
$font='font/arial.ttf';
imagettftext($im,36,0176695,$red,$font,$\u POST['Tdesc']);
ob_start();
图像PNG($im);
$image=ob_get_contents();
ob_end_clean();
回声'
通用优惠券
';
}

我想通过指定他的姓名和分机名下载此图像,并将其发送到addres电子邮件

告诉用户右键单击/另存为文件。现在,您只需将一个图像嵌入表单标记中。它不会与表单一起提交,也不会上载回服务器。否则,当表单提交时,您将无法在服务器上重新生成图像,此时,发送电子邮件将变得非常简单。至于你现在拥有的,你将有很多事情要做。。。