public static function saveImageDataInAnyFormat($data, $preferred_mime)
public static function saveImageDataInAnyFormat($data, $preferred_mime)
Save an image resource to a string representation suitable for storage or transmission as an image file.
Optionally, you can specify a preferred MIME type like "image/png". Generally, you should specify the MIME type of the original file if you're applying file transformations. The MIME type may not be honored if Phabricator can not encode images in the given format (based on available extensions), but can save images in another format.
Parameters
resource | $data | GD image resource. |
string? | $preferred_mime | Optionally, preferred mime type. |
Return
string | Bytes of an image file. |
private static function saveImageDataAsPNG($image)
private static function saveImageDataAsPNG($image)
Save an image in PNG format, returning the file data as a string.
Parameters
resource | $image | GD image resource. |
Return
string|null | PNG file as a string, or null on failure. |
private static function saveImageDataAsGIF($image)
private static function saveImageDataAsGIF($image)
Save an image in GIF format, returning the file data as a string.
Parameters
resource | $image | GD image resource. |
Return
string|null | GIF file as a string, or null on failure. |
private static function saveImageDataAsJPG($image)
private static function saveImageDataAsJPG($image)
Save an image in JPG format, returning the file data as a string.
Parameters
resource | $image | GD image resource. |
Return
string|null | JPG file as a string, or null on failure. |