PHP/GD库Imagettftext在服务器上保存图像并发送到浏览器

PHP/GD库Imagettftext在服务器上保存图像并发送到浏览器,php,gd,Php,Gd,我正在使用GD在图像(已经在我的服务器上)上覆盖一些文本。我正在尝试将新映像保存到服务器上 <? //PHP's GD class functions can create a variety of output image //types, this example creates a jpeg header("Content-Type: image/jpeg"); $im = imagecreatefromjpeg($image_full);

我正在使用GD在图像(已经在我的服务器上)上覆盖一些文本。我正在尝试将新映像保存到服务器上

        <?
//PHP's GD class functions can create a variety of output image
    //types, this example creates a jpeg
    header("Content-Type: image/jpeg");

    $im = imagecreatefromjpeg($image_full); 

    $black = ImageColorAllocate($im, 255, 255, 255);


    $copy_1_x = 10;
    $copy_1_y = 20;

    $copy_2_x = 10;
    $copy_2_y = 20;

    $copy_3_x = 10;
    $copy_3_y = 20;

    //writes text to image
    Imagettftext($im, 12, 0, $copy_1_x, $copy_1_y, $black, 'verdana.ttf', $main_number);
    Imagettftext($im, 12, 0, $copy_2_x, $copy_2_y, $black, 'verdana.ttf', $prime_number);
    Imagettftext($im, 12, 0, $copy_3_x, $copy_3_y, $black, 'verdana.ttf', $legal);

    //Creates the jpeg image and sends it to the browser
    //100 is the jpeg quality percentage
    Imagejpeg($im, '', 100);


    ImageDestroy($im);



        ?>
下面是我的代码,但它所做的只是向浏览器显示新图像,而不是将其保存到服务器

        <?
//PHP's GD class functions can create a variety of output image
    //types, this example creates a jpeg
    header("Content-Type: image/jpeg");

    $im = imagecreatefromjpeg($image_full); 

    $black = ImageColorAllocate($im, 255, 255, 255);


    $copy_1_x = 10;
    $copy_1_y = 20;

    $copy_2_x = 10;
    $copy_2_y = 20;

    $copy_3_x = 10;
    $copy_3_y = 20;

    //writes text to image
    Imagettftext($im, 12, 0, $copy_1_x, $copy_1_y, $black, 'verdana.ttf', $main_number);
    Imagettftext($im, 12, 0, $copy_2_x, $copy_2_y, $black, 'verdana.ttf', $prime_number);
    Imagettftext($im, 12, 0, $copy_3_x, $copy_3_y, $black, 'verdana.ttf', $legal);

    //Creates the jpeg image and sends it to the browser
    //100 is the jpeg quality percentage
    Imagejpeg($im, '', 100);


    ImageDestroy($im);



        ?>
谢谢@Ignacio

Imagejpeg($im, '/path_to_folder/imagename.jpg', 100);

可在

找到,谢谢。实际上,我已经查看了页面,但没有看到另存为文件的示例。