Php saves pictures

public function create_img_text(){
        $dst_path = "./public/upload/kezi/2018/11-14/4dee0588f076e26f9266ce7e9cce4c8f.png";
        $text = "";
        $dst = imagecreatefromstring(file_get_contents($dst_path));
        $font = "./public/font/simsun.ttc";
        $black = imagecolorallocate($dst, 0x00, 0x00, 0x00);
        imagefttext($dst, 18, -10, 30, 40, $black, $font, $text);
//        $img = getimagesize($dst_path);
//        var_dump($img);
//        exit;
          list($dst_w, $dst_h, $dst_type) = getimagesize($dst_path);
          switch ($dst_type) {
              case 1://GIF
                  header("Content-Type: image/gif");
                  imagegif($dst);
                  break;
              case 2://JPG
                  header("Content-Type: image/jpeg");
                  imagejpeg($dst);
                  break;
              case 3://PNG
                  header("Content-Type: image/png");
                  imagepng($dst);
                  break;
              default:
                  break;
          }

        imagedestroy($dst);
        exit;
    }
 
Php
Nov.26,2021

imagegif (resource image [, string filename]): export images to browsers or files in GIF format
imagejpeg (resource image [, string filename [, int quality]]): export images to browsers or files in JPEG format
imagepng (resource image [, string filename]): export images to browsers or files in PNG format
imagewbmp (resource image [, string filename [, int foreground]]): export images to browsers or files in WBMP format

the return value of the image resources to be output by image:, such as imagecreate () or imagecreatefrom series functions
filename: is optional, specify the file name of the output image. If omitted, the original image stream is output directly.
quality: optional, specify image quality, range from 0 (worst quality, smallest file) to 100th (best quality, largest file), default 75, imagejpeg () unique parameter
foreground: optional, specify foreground color, default foreground color is black, imagewbmp () unique parameter


imagejpeg, imagepng series functions. If you have a second parameter $to, if you specify $to, you can save it to the specified location

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3b03b-2c251.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3b03b-2c251.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?