class Image (View source)

Properties

protected GdImage|resource $image

Berisi resource gambar.

protected string $path

Berisi file path (absolut).

protected string $type

Berisi tipe gambar saat ini.

protected int $quality

Berisi kualitas gambar.

protected int $width

Berisi lebar gambar.

protected int $height

Berisi tinggi gambar.

protected array $exif

Berisi info exif data.

Methods

__construct(string $path, int $quality = 75)

Konstruktor.

static $this
open(string $path, $quality = 75)

Buka gambar untuk diproses (jpg, png, gif).

$this
load(string $path)

Muat file gambar.

$this
width(int $value)

Resize lebar gambar.

$this
height(int $value)

Resize tinggi gambar.

$this
rotate(int $angle = 90)

Putar gambar per 90 derajat.

$this
crop(int $left, int $top, int $width, int $height)

Crop gambar.

$this
ratio(int $width = 1, int $height = 1)

Resize gambar dari tengah menggunakan rasio yang diberikan.

$this
contrast(int $level)

Atur kontras gambar (rentang: -100 to +100).

$this
brightness(int $level)

Atur kecerahan gambar (rentang: -100 to +100).

$this
smoothness(int $level)

Atur kelembutan gambar (rentang: -100 to +100).

$this
blur(bool $selective = false)

Tambahkan efek buram (gaussian / selective blur).

$this
grayscale()

Tambahkan efek grayscale.

$this
sepia()

Tambahkan efek sepia.

$this
edge()

Tambahkan efek edges-highlight.

$this
emboss()

Tambahkan efek emboss.

$this
sketch()

Tambahkan efek sketch.

$this
invert()

Tambahkan efek inversi warna.

$this
pixelate(int $value)

Tambahkah efek pixelate (rentang: -100 to +100).

$this
watermark(string $watermark)

Tambahkan watermark ke gambar.

bool
export(string $path, bool $overwrite = false)

Simpan perubahan ke disk.

resource
dump()

Return resource gambar.

array
info()

Ambil info gambar.

void
reset()

Reset.

static Response|resource
identicon(string $seed, int $size = 64, bool $display = false)

Buat identicon.

maintain()

Helper untuk set atribut lebar dan tinggi gambar.

string
path(string $path)

Mereturn path ke file gambar (absolut).

static bool
available()

Periksa ketersediaan eksensi php-gd.

static bool
acceptable(string $path)

Periksa apakah tipe gambar diizinkan.

__destruct()

Destruktor.

Details

__construct(string $path, int $quality = 75)

Konstruktor.

Parameters

string $path
int $quality

static $this open(string $path, $quality = 75)

Buka gambar untuk diproses (jpg, png, gif).

Parameters

string $path
$quality

Return Value

$this

protected $this load(string $path)

Muat file gambar.

Parameters

string $path

Return Value

$this

$this width(int $value)

Resize lebar gambar.

Parameters

int $value

Return Value

$this

$this height(int $value)

Resize tinggi gambar.

Parameters

int $value

Return Value

$this

$this rotate(int $angle = 90)

Putar gambar per 90 derajat.

Parameters

int $angle

Return Value

$this

$this crop(int $left, int $top, int $width, int $height)

Crop gambar.

Parameters

int $left
int $top
int $width
int $height

Return Value

$this

$this ratio(int $width = 1, int $height = 1)

Resize gambar dari tengah menggunakan rasio yang diberikan.

cth: 500x200 rasio 1:1 (kotak) = 200x200. cth: 500x200 rasio 3:4 = 150x200.

Parameters

int $width
int $height

Return Value

$this

$this contrast(int $level)

Atur kontras gambar (rentang: -100 to +100).

Parameters

int $level

Return Value

$this

$this brightness(int $level)

Atur kecerahan gambar (rentang: -100 to +100).

Parameters

int $level

Return Value

$this

$this smoothness(int $level)

Atur kelembutan gambar (rentang: -100 to +100).

Parameters

int $level

Return Value

$this

$this blur(bool $selective = false)

Tambahkan efek buram (gaussian / selective blur).

Parameters

bool $selective

Return Value

$this

$this grayscale()

Tambahkan efek grayscale.

Return Value

$this

$this sepia()

Tambahkan efek sepia.

Return Value

$this

$this edge()

Tambahkan efek edges-highlight.

Return Value

$this

$this emboss()

Tambahkan efek emboss.

Return Value

$this

$this sketch()

Tambahkan efek sketch.

Return Value

$this

$this invert()

Tambahkan efek inversi warna.

Return Value

$this

$this pixelate(int $value)

Tambahkah efek pixelate (rentang: -100 to +100).

Parameters

int $value

Return Value

$this

$this watermark(string $watermark)

Tambahkan watermark ke gambar.

Parameters

string $watermark

Return Value

$this

bool export(string $path, bool $overwrite = false)

Simpan perubahan ke disk.

Parameters

string $path
bool $overwrite

Return Value

bool

resource dump()

Return resource gambar.

Return Value

resource

array info()

Ambil info gambar.

Return Value

array

void reset()

Reset.

Return Value

void

static Response|resource identicon(string $seed, int $size = 64, bool $display = false)

Buat identicon.

Parameters

string $seed
int $size
bool $display

Return Value

Response|resource

protected maintain()

Helper untuk set atribut lebar dan tinggi gambar.

string path(string $path)

Mereturn path ke file gambar (absolut).

Parameters

string $path

Return Value

string

static bool available()

Periksa ketersediaan eksensi php-gd.

Return Value

bool

static bool acceptable(string $path)

Periksa apakah tipe gambar diizinkan.

Parameters

string $path

Return Value

bool

__destruct()

Destruktor.