PHP Класс Pop\Image\AbstractImage

Автор: Nick Sagona, III ([email protected])
Наследование: implements Pop\Image\ImageInterface
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$alpha boolean Image alpha
$backgroundColor mixed Image background color
$channels integer Image channels
$depth integer Image bit depth
$fillColor mixed Image fill color
$height integer Image height
$info ArrayObject Image extension info
$mode string Image mode
$quality integer | string Image quality
$resource resource Image resource
$strokeColor mixed Image stroke color
$strokeWidth integer Image stroke width
$width integer Image width

Открытые методы

Метод Описание
__construct ( string $img, integer | string $w = null, integer | string $h = null, Pop\Color\Space\ColorInterface $color = null, array $types = null ) : AbstractImage Constructor
border ( integer $w, integer $h = null, integer $type = AbstractImage::INNER_BORDER ) : mixed Method to add a border to the image.
brightness ( integer $b ) : mixed Method to adjust the brightness of the image.
colorTotal ( ) : integer Return the number of colors in the palette of indexed images.
colorize ( Pop\Color\Space\ColorInterface $color ) : mixed Method to colorize the image with the color passed.
contrast ( integer $amount ) : mixed Method to adjust the contrast of the image.
convert ( string $type ) : mixed Convert the image object to the new specified image type.
crop ( integer | string $wid, integer | string $hgt, integer | string $x, integer | string $y ) : mixed Crop the image object to a image whose dimensions are based on the value of the $wid and $hgt argument. The optional $x and $y arguments allow for the adjustment of the crop to select a certain area of the image to be cropped.
cropThumb ( integer | string $px, integer | string $x, integer | string $y ) : mixed Crop the image object to a square image whose dimensions are based on the value of the $px argument. The optional $x and $y arguments allow for the adjustment of the crop to select a certain area of the image to be cropped. For example, if the values of $px = 50, $x = 20, $y = 0 are passed, then a 50px X 50px image will be created from the original image, with its origins starting at the (20, 0) x-y coordinates.
destroy ( boolean $file = false ) : void Destroy the image object and the related image file directly.
drawArc ( integer $x, integer $y, integer $start, integer $end, integer $w, integer $h = null ) : void Method to add an arc to the image.
drawCircle ( integer $x, integer $y, integer $w ) : void Method to add a circle to the image.
drawEllipse ( integer $x, integer $y, integer $w, integer $h = null ) : void Method to add an ellipse to the image.
drawLine ( integer $x1, integer $y1, integer $x2, integer $y2 ) : void Method to add a line to the image.
drawPolygon ( array $points ) : void Method to add a polygon to the image.
drawRectangle ( integer $x, integer $y, integer $w, integer $h = null ) : void Method to add a rectangle to the image.
drawSquare ( integer $x, integer $y, integer $w ) : void Method to add a square to the image.
getChannels ( ) : integer Get the number of image channels.
getColorMode ( ) : string Get the image color mode.
getColors ( string $format = 'HEX' ) : array Return all of the colors in the palette in an array format, omitting any repeats. It is strongly advised that this method only be used for smaller image files, preferably with small palettes, as any large images with many colors will cause this method to run slowly. Default format of the values in the returned array is the 6-digit HEX value, but if 'RGB' is passed, then the format of the values in the returned array will be 'R,G,B', i.e. '235,123,12'.
getDepth ( ) : integer Get the image bit depth.
getHeight ( ) : integer Get the image height.
getWidth ( ) : integer Get the image width.
hasAlpha ( ) : boolean Get whether or not the image has an alpha channel.
info ( ) : ArrayObject Get the image resource info
invert ( ) : mixed Method to invert the image (create a negative.)
overlay ( string $ovr, integer | string $x, integer | string $y ) : mixed Overlay an image onto the current image.
resize ( integer | string $px ) : mixed Resize the image object, allowing for the largest dimension to be scaled to the value of the $px argument. For example, if the value of $px = 200, and the image is 800px X 600px, then the image will be scaled to 200px X 150px.
resizeToHeight ( integer | string $hgt ) : mixed Resize the image object to the height parameter passed.
resizeToWidth ( integer | string $wid ) : mixed Resize the image object to the width parameter passed.
rotate ( integer | string $deg ) : mixed Rotate the image object, using simple degrees, i.e. -90, to rotate the image.
scale ( float | string $scl ) : mixed Scale the image object, allowing for the dimensions to be scaled proportionally to the value of the $scl argument. For example, if the value of $scl = 0.50, and the image is 800px X 600px, then the image will be scaled to 400px X 300px.
setBackgroundColor ( Pop\Color\Space\ColorInterface $color = null ) : mixed Set the background color.
setFillColor ( Pop\Color\Space\ColorInterface $color = null ) : mixed Set the fill color.
setOpacity ( integer | string $opac ) : mixed Set the opacity.
setQuality ( integer | string $q = null ) : mixed Set the image quality based on the type of image.
setStrokeColor ( Pop\Color\Space\ColorInterface $color = null ) : mixed Set the stroke color.
setStrokeWidth ( integer | string $wid = null ) : mixed Set the stroke width.
text ( string $str, integer | string $size, integer | string $x, integer | string $y, string $font = null, integer | string $rotate = null, boolean $stroke = false ) : mixed Create text within the an image object. A font file can be used for the font argument. The size, rotation and position can be set by those arguments.

Защищенные методы

Метод Описание
setColor ( Pop\Color\Space\ColorInterface $color = null ) : mixed Set and return a color identifier.

Описание методов

__construct() публичный Метод

Instantiate an image file object based on either a pre-existing image file on disk, or a new image file.
public __construct ( string $img, integer | string $w = null, integer | string $h = null, Pop\Color\Space\ColorInterface $color = null, array $types = null ) : AbstractImage
$img string
$w integer | string
$h integer | string
$color Pop\Color\Space\ColorInterface
$types array
Результат AbstractImage

border() абстрактный публичный Метод

Method to add a border to the image.
abstract public border ( integer $w, integer $h = null, integer $type = AbstractImage::INNER_BORDER ) : mixed
$w integer
$h integer
$type integer
Результат mixed

brightness() абстрактный публичный Метод

Method to adjust the brightness of the image.
abstract public brightness ( integer $b ) : mixed
$b integer
Результат mixed

colorTotal() абстрактный публичный Метод

Returns 0 for true color images.
abstract public colorTotal ( ) : integer
Результат integer

colorize() абстрактный публичный Метод

Method to colorize the image with the color passed.
abstract public colorize ( Pop\Color\Space\ColorInterface $color ) : mixed
$color Pop\Color\Space\ColorInterface
Результат mixed

contrast() абстрактный публичный Метод

Method to adjust the contrast of the image.
abstract public contrast ( integer $amount ) : mixed
$amount integer
Результат mixed

convert() абстрактный публичный Метод

Convert the image object to the new specified image type.
abstract public convert ( string $type ) : mixed
$type string
Результат mixed

crop() абстрактный публичный Метод

Crop the image object to a image whose dimensions are based on the value of the $wid and $hgt argument. The optional $x and $y arguments allow for the adjustment of the crop to select a certain area of the image to be cropped.
abstract public crop ( integer | string $wid, integer | string $hgt, integer | string $x, integer | string $y ) : mixed
$wid integer | string
$hgt integer | string
$x integer | string
$y integer | string
Результат mixed

cropThumb() абстрактный публичный Метод

Crop the image object to a square image whose dimensions are based on the value of the $px argument. The optional $x and $y arguments allow for the adjustment of the crop to select a certain area of the image to be cropped. For example, if the values of $px = 50, $x = 20, $y = 0 are passed, then a 50px X 50px image will be created from the original image, with its origins starting at the (20, 0) x-y coordinates.
abstract public cropThumb ( integer | string $px, integer | string $x, integer | string $y ) : mixed
$px integer | string
$x integer | string
$y integer | string
Результат mixed

destroy() абстрактный публичный Метод

Destroy the image object and the related image file directly.
abstract public destroy ( boolean $file = false ) : void
$file boolean
Результат void

drawArc() абстрактный публичный Метод

Method to add an arc to the image.
abstract public drawArc ( integer $x, integer $y, integer $start, integer $end, integer $w, integer $h = null ) : void
$x integer
$y integer
$start integer
$end integer
$w integer
$h integer
Результат void

drawCircle() абстрактный публичный Метод

Method to add a circle to the image.
abstract public drawCircle ( integer $x, integer $y, integer $w ) : void
$x integer
$y integer
$w integer
Результат void

drawEllipse() абстрактный публичный Метод

Method to add an ellipse to the image.
abstract public drawEllipse ( integer $x, integer $y, integer $w, integer $h = null ) : void
$x integer
$y integer
$w integer
$h integer
Результат void

drawLine() абстрактный публичный Метод

Method to add a line to the image.
abstract public drawLine ( integer $x1, integer $y1, integer $x2, integer $y2 ) : void
$x1 integer
$y1 integer
$x2 integer
$y2 integer
Результат void

drawPolygon() абстрактный публичный Метод

Method to add a polygon to the image.
abstract public drawPolygon ( array $points ) : void
$points array
Результат void

drawRectangle() абстрактный публичный Метод

Method to add a rectangle to the image.
abstract public drawRectangle ( integer $x, integer $y, integer $w, integer $h = null ) : void
$x integer
$y integer
$w integer
$h integer
Результат void

drawSquare() абстрактный публичный Метод

Method to add a square to the image.
abstract public drawSquare ( integer $x, integer $y, integer $w ) : void
$x integer
$y integer
$w integer
Результат void

getChannels() публичный Метод

Get the number of image channels.
public getChannels ( ) : integer
Результат integer

getColorMode() публичный Метод

Get the image color mode.
public getColorMode ( ) : string
Результат string

getColors() абстрактный публичный Метод

Return all of the colors in the palette in an array format, omitting any repeats. It is strongly advised that this method only be used for smaller image files, preferably with small palettes, as any large images with many colors will cause this method to run slowly. Default format of the values in the returned array is the 6-digit HEX value, but if 'RGB' is passed, then the format of the values in the returned array will be 'R,G,B', i.e. '235,123,12'.
abstract public getColors ( string $format = 'HEX' ) : array
$format string
Результат array

getDepth() публичный Метод

Get the image bit depth.
public getDepth ( ) : integer
Результат integer

getHeight() публичный Метод

Get the image height.
public getHeight ( ) : integer
Результат integer

getWidth() публичный Метод

Get the image width.
public getWidth ( ) : integer
Результат integer

hasAlpha() публичный Метод

Get whether or not the image has an alpha channel.
public hasAlpha ( ) : boolean
Результат boolean

info() публичный Метод

Get the image resource info
public info ( ) : ArrayObject
Результат ArrayObject

invert() абстрактный публичный Метод

Method to invert the image (create a negative.)
abstract public invert ( ) : mixed
Результат mixed

overlay() абстрактный публичный Метод

Overlay an image onto the current image.
abstract public overlay ( string $ovr, integer | string $x, integer | string $y ) : mixed
$ovr string
$x integer | string
$y integer | string
Результат mixed

resize() абстрактный публичный Метод

Resize the image object, allowing for the largest dimension to be scaled to the value of the $px argument. For example, if the value of $px = 200, and the image is 800px X 600px, then the image will be scaled to 200px X 150px.
abstract public resize ( integer | string $px ) : mixed
$px integer | string
Результат mixed

resizeToHeight() абстрактный публичный Метод

Resize the image object to the height parameter passed.
abstract public resizeToHeight ( integer | string $hgt ) : mixed
$hgt integer | string
Результат mixed

resizeToWidth() абстрактный публичный Метод

Resize the image object to the width parameter passed.
abstract public resizeToWidth ( integer | string $wid ) : mixed
$wid integer | string
Результат mixed

rotate() абстрактный публичный Метод

Rotate the image object, using simple degrees, i.e. -90, to rotate the image.
abstract public rotate ( integer | string $deg ) : mixed
$deg integer | string
Результат mixed

scale() абстрактный публичный Метод

Scale the image object, allowing for the dimensions to be scaled proportionally to the value of the $scl argument. For example, if the value of $scl = 0.50, and the image is 800px X 600px, then the image will be scaled to 400px X 300px.
abstract public scale ( float | string $scl ) : mixed
$scl float | string
Результат mixed

setBackgroundColor() публичный Метод

Set the background color.
public setBackgroundColor ( Pop\Color\Space\ColorInterface $color = null ) : mixed
$color Pop\Color\Space\ColorInterface
Результат mixed

setColor() абстрактный защищенный Метод

Set and return a color identifier.
abstract protected setColor ( Pop\Color\Space\ColorInterface $color = null ) : mixed
$color Pop\Color\Space\ColorInterface
Результат mixed

setFillColor() публичный Метод

Set the fill color.
public setFillColor ( Pop\Color\Space\ColorInterface $color = null ) : mixed
$color Pop\Color\Space\ColorInterface
Результат mixed

setOpacity() абстрактный публичный Метод

Set the opacity.
abstract public setOpacity ( integer | string $opac ) : mixed
$opac integer | string
Результат mixed

setQuality() абстрактный публичный Метод

Set the image quality based on the type of image.
abstract public setQuality ( integer | string $q = null ) : mixed
$q integer | string
Результат mixed

setStrokeColor() публичный Метод

Set the stroke color.
public setStrokeColor ( Pop\Color\Space\ColorInterface $color = null ) : mixed
$color Pop\Color\Space\ColorInterface
Результат mixed

setStrokeWidth() публичный Метод

Set the stroke width.
public setStrokeWidth ( integer | string $wid = null ) : mixed
$wid integer | string
Результат mixed

text() абстрактный публичный Метод

Create text within the an image object. A font file can be used for the font argument. The size, rotation and position can be set by those arguments.
abstract public text ( string $str, integer | string $size, integer | string $x, integer | string $y, string $font = null, integer | string $rotate = null, boolean $stroke = false ) : mixed
$str string
$size integer | string
$x integer | string
$y integer | string
$font string
$rotate integer | string
$stroke boolean
Результат mixed

Описание свойств

$alpha защищенное свойство

Image alpha
protected bool $alpha
Результат boolean

$backgroundColor защищенное свойство

Image background color
protected mixed $backgroundColor
Результат mixed

$channels защищенное свойство

Image channels
protected int $channels
Результат integer

$depth защищенное свойство

Image bit depth
protected int $depth
Результат integer

$fillColor защищенное свойство

Image fill color
protected mixed $fillColor
Результат mixed

$height защищенное свойство

Image height
protected int $height
Результат integer

$info защищенное свойство

Image extension info
protected ArrayObject $info
Результат ArrayObject

$mode защищенное свойство

Image mode
protected string $mode
Результат string

$quality защищенное свойство

Image quality
protected int|string $quality
Результат integer | string

$resource защищенное свойство

Image resource
protected resource $resource
Результат resource

$strokeColor защищенное свойство

Image stroke color
protected mixed $strokeColor
Результат mixed

$strokeWidth защищенное свойство

Image stroke width
protected int $strokeWidth
Результат integer

$width защищенное свойство

Image width
protected int $width
Результат integer