PHP Class Webiny\Component\Image\ImageLoader

You can load images using these methods: - open => opens an image from disk by providing an instance of \Webiny\Component\Storage\File\File - load => creates an image from given binary string - create => creates a blank image - resource => create an image from the given resource, e.g. from upload stream
Inheritance: use trait Webiny\Component\StdLib\StdLibTrait
Show file Open project: Webiny/Framework Class Usage Examples

Public Methods

Method Description
create ( integer $width, integer $height, string $bgColor = null ) : Webiny\Component\Image\ImageInterface Create a blank image with of given dimensions and fill it with $bgColor.
load ( string $string ) : mixed Create a new ImageInterface instance form the given binary string.
open ( File $image ) : Webiny\Component\Image\ImageInterface Creates a new ImageInterface instance from the given image at the provided path.
resource ( mixed $resource ) : Webiny\Component\Image\ImageInterface Create a new ImageInterface instance from the given resource.

Private Methods

Method Description
fixImageOrientation ( File $imageFile, Webiny\Component\Image\ImageInterface $image ) Android and Iphone images are sometimes rotated "incorrectly".
getLoader ( ) : null | Webiny\Component\Image\Bridge\ImageLoaderInterface Returns an instance of ImageLoaderInterface.

Method Details

create() public static method

Create a blank image with of given dimensions and fill it with $bgColor.
public static create ( integer $width, integer $height, string $bgColor = null ) : Webiny\Component\Image\ImageInterface
$width integer Width of the new image.
$height integer Height of the new image.
$bgColor string Background color. Following formats are acceptable - "fff" - "ffffff" - array(255,255,255)
return Webiny\Component\Image\ImageInterface

load() public static method

Create a new ImageInterface instance form the given binary string.
public static load ( string $string ) : mixed
$string string Binary string that holds image information.
return mixed

open() public static method

Creates a new ImageInterface instance from the given image at the provided path.
public static open ( File $image ) : Webiny\Component\Image\ImageInterface
$image Webiny\Component\Storage\File\File Path to an image on the disk.
return Webiny\Component\Image\ImageInterface

resource() public static method

Create a new ImageInterface instance from the given resource.
public static resource ( mixed $resource ) : Webiny\Component\Image\ImageInterface
$resource mixed Resource.
return Webiny\Component\Image\ImageInterface