Documentation

Core_Image_Imagick extends Core_Image
in package

ImageMagick

http://www.php.net/manual/book.imagick.php

Tags
subpackage

Core

version
7.x
author

Hostmake LLC

copyright

© 2005-2024 ООО "Хостмэйк" (Hostmake LLC), http://www.hostcms.ru

Table of Contents

Properties

$instance  : mixed
The singleton instances.
$_aFormats  : array<string|int, mixed>
Supported Image Formats https://imagemagick.org/script/formats.php
$_config  : mixed
Driver's configuration

Methods

addWatermark()  : bool
Добавление watermark на изображение. Если файл watermark не существует, метод скопирует исходное изображение
avatar()  : mixed
Create avatar
exifImagetype()  : mixed
Implement exifImagetype function
getImageSize()  : mixed
Get image size
getImageType()  : mixed
Get Image Type: 0 = UNKNOWN, 1 = GIF, 2 = JPG, 3 = PNG, 4 = SWF, 5 = PSD, 6 = BMP, 7 = TIFF (orden de bytes intel), 8 = TIFF (orden de bytes motorola), 9 = JPC, 10 = JP2, 11 = JPX, 12 = JB2, 13 = SWC, 14 = IFF, 15 = WBMP, 16 = XBM, 17 = ICO, 18 = WEBP
getImagetypeByFormat()  : int|null
Get IMAGETYPE_xxx by $outputFormat
getIMVersion()  : string
Get ImageMagick version
instance()  : object
Register an existing instance as a singleton.
isAvailable()  : bool
Check Imagick-Module Availability
resizeImage()  : bool
Пропорциональное масштабирование изображения
_getDriverName()  : srting
Get full driver name

Properties

$instance

The singleton instances.

public static mixed $instance = array()

$_aFormats

Supported Image Formats https://imagemagick.org/script/formats.php

protected static array<string|int, mixed> $_aFormats = array('GIF' => 1, 'JPEG' => 2, 'PNG' => 3, 'PNG8' => 3, 'PNG00' => 3, 'PNG24' => 3, 'PNG32' => 3, 'PNG48' => 3, 'PNG64' => 3, 'PSD' => 5, 'BMP' => 6, 'BMP2' => 6, 'BMP3' => 6, 'TIFF' => 7, 'JP2' => 10, 'JPT' => 10, 'J2C' => 10, 'J2K' => 10, 'WBMP' => 15, 'XBM' => 16, 'ICO' => 17, 'WEBP' => 18)

$_config

Driver's configuration

protected static mixed $_config = \NULL

Methods

addWatermark()

Добавление watermark на изображение. Если файл watermark не существует, метод скопирует исходное изображение

public addWatermark(string $source, string $target, string $watermark[, string $watermarkX = NULL ][, string $watermarkY = NULL ][, string|null $outputFormat = NULL ]) : bool
Parameters
$source : string

путь к файлу источнику

$target : string

путь к файлу получателю

$watermark : string

путь к файлу watermark в формате PNG

$watermarkX : string = NULL

позиция по оси X (в пикселях или процентах)

$watermarkY : string = NULL

позиция по оси Y (в пикселях или процентах)

$outputFormat : string|null = NULL

формат, в котором сохранять изображение, по умолчанию NULL равен формату исходного

addWatermark($source, $target, $watermark); ?>
Return values
bool

avatar()

Create avatar

public static avatar(string $initials[, string $bgColor = '#f44336' ][, int $width = 130 ][, int $height = 130 ]) : mixed
Parameters
$initials : string
$bgColor : string = '#f44336'
$width : int = 130
$height : int = 130

exifImagetype()

Implement exifImagetype function

public static exifImagetype(string $path) : mixed
Parameters
$path : string

getImageSize()

Get image size

public getImageSize(string $path) : mixed
Parameters
$path : string

path

getImageType()

Get Image Type: 0 = UNKNOWN, 1 = GIF, 2 = JPG, 3 = PNG, 4 = SWF, 5 = PSD, 6 = BMP, 7 = TIFF (orden de bytes intel), 8 = TIFF (orden de bytes motorola), 9 = JPC, 10 = JP2, 11 = JPX, 12 = JB2, 13 = SWC, 14 = IFF, 15 = WBMP, 16 = XBM, 17 = ICO, 18 = WEBP

public getImageType(string $path) : mixed
Parameters
$path : string

getImagetypeByFormat()

Get IMAGETYPE_xxx by $outputFormat

public static getImagetypeByFormat(string $outputFormat) : int|null
Parameters
$outputFormat : string

Output Format, e.g. 'webp'

Return values
int|null

getIMVersion()

Get ImageMagick version

public getIMVersion() : string
Return values
string

instance()

Register an existing instance as a singleton.

public static instance([string $name = 'default' ]) : object
Parameters
$name : string = 'default'

driver's name

Return values
object

isAvailable()

Check Imagick-Module Availability

public isAvailable() : bool
Return values
bool

resizeImage()

Пропорциональное масштабирование изображения

public resizeImage(string $sourceFile, int $maxWidth, int $maxHeight, string $targetFile[, int $quality = NULL ][, int $preserveAspectRatio = TRUE ][, string|null $outputFormat = NULL ]) : bool
Parameters
$sourceFile : string

путь к исходному файлу

$maxWidth : int

максимальная ширина картинки

$maxHeight : int

максимальная высота картинки

$targetFile : string

путь к результирующему файлу

$quality : int = NULL

качество JPEG/PNG файла, если не передано, то берется из констант

$preserveAspectRatio : int = TRUE

сохранять пропорции изображения

$outputFormat : string|null = NULL

формат, в котором сохранять изображение, по умолчанию NULL равен формату исходного

resizeImage($sourceFile, 100, 50, $targetFile); ?>
Return values
bool

_getDriverName()

Get full driver name

protected static _getDriverName(string $driver) : srting
Parameters
$driver : string

driver name

Return values
srting

        
On this page

Search results