Php gd library synthesizes pictures and uploads oss? (do not generate picture files on the server)

use gd library to synthesize pictures. How to obtain image data and upload them to oss? directly

Apr.05,2021

https://help.aliyun.com/docum.


The string of

PHP is binary safe, and the binary data can be saved directly into the string.

Functions such as imagepng and imagejpeg of

GD are directly output to the browser when the file path is not set. We can use the Output Control function to intercept the output stream.

ob_start();   //
imagepng($image);    //
$imagebin=ob_get_contents();    //
ob_end_clean();    //
The content in

$imagebin is the same as the binary data that is saved to a file and read with file_get_contents .

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-1bf90f9-3215b.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-1bf90f9-3215b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?