• Full name: \App\Shared\Services\Image
  • This class is marked as final and can't be subclassed
  • This class is a Final class

Methods

resize

Resize image function.

public static resize(int $width, int $height, int $target): string

Example Usage:

$size = getimagesize('static/assets/img/avatar.png'); $this->resize($size[0], $size[1], 80);

  • This method is static. Parameters:
Parameter Type Description
$width int Width of the image.
$height int Height of the image.
$target int Size of image.

manipulate

Manipulate image(s) with an expressive API

public manipulate(array $params = []): bool|\App\Shared\Services\Image

Parameters:

Parameter Type Description
$params array An array of parameters for image manipulation.
@type string $image_source The source of the original image.
@type string $image_destination The destination of the new image.
@type bool $image_sepia Whether to add sepia filter.
@type int $image_blur Blue the image.
@type bool $image_original Whether to return/save new image to original size.
@type int $image_width Width of new image in pixels.
@type int $image_height Height of new image in pixels
@type string $image_format Whether to show content in search.
@type int $image_quality Quality percent. Only applies for jpeg.
@type int $image_brightness The content's featured image.
@type int $image_contrast Adjusts the contrast of image.
@type int $image_gamma Adjusts the gamma of image.
@type string $image_background Sets the background of transparent images.
@type string $image_fit Fits the image with the given width and height.
@type string $image_crop Cropped to the given width and height.
@type array $image_border Adds border to image.
@type string $image_orientation Rotate the image.
@type int $image_pixelate Pixelates the image.
@type bool $image_greyscale Converts image to greyscale.
@type int $image_sharpen Sharpens the image.
@type array $image_watermark Adds a watermark to image.

Throws: