Page MenuHomeIsabelle/Phabricator
Diviner Phabricator Tech Docs PhabricatorImageTransformer

final class PhabricatorImageTransformer
Phabricator Technical Documentation (Files)

This class is not documented.

Tasks

Detecting Enormous Images

No methods for this task.

Saving Image Data

  • public static function saveImageDataInAnyFormat($data, $preferred_mime) — Save an image resource to a string representation suitable for storage or transmission as an image file.
  • private static function saveImageDataAsPNG($image) — Save an image in PNG format, returning the file data as a string.
  • private static function saveImageDataAsGIF($image) — Save an image in GIF format, returning the file data as a string.
  • private static function saveImageDataAsJPG($image) — Save an image in JPG format, returning the file data as a string.

Methods

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$dataGD image resource.
string?$preferred_mimeOptionally, preferred mime type.
Return
stringBytes of an image file.

private static function saveImageDataAsPNG($image)

Save an image in PNG format, returning the file data as a string.

Parameters
resource$imageGD image resource.
Return
string|nullPNG file as a string, or null on failure.

private static function saveImageDataAsGIF($image)

Save an image in GIF format, returning the file data as a string.

Parameters
resource$imageGD image resource.
Return
string|nullGIF file as a string, or null on failure.

private static function saveImageDataAsJPG($image)

Save an image in JPG format, returning the file data as a string.

Parameters
resource$imageGD image resource.
Return
string|nullJPG file as a string, or null on failure.