PHP Класс Pop\Image\Gd

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

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

Свойство Тип Описание
$allowed array Array of allowed file types.
$opacity integer Image color opacity

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

Метод Описание
__construct ( string $img, integer | string $w = null, integer | string $h = null, Pop\Color\Space\ColorInterface $color = null, array $types = null ) : Gd Constructor
__destruct ( ) : void Destructor to destroy the image resource
__toString ( ) : string To string method to output the image
blur ( integer $amount, integer $type = Gd::GAUSSIAN_BLUR ) : Gd Method to blur the image.
border ( integer $w, integer $h = null, integer $type = Gd::INNER_BORDER ) : Gd Method to add a border to the image.
brightness ( integer $b ) : Gd 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 ) : Gd Method to colorize the image with the color passed.
contrast ( integer $amount ) : Gd Method to adjust the contrast of the image.
convert ( string $type ) : Gd 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
cropThumb ( integer | string $px, integer | string $x, integer | string $y ) : Gd Crop the image object to a square image
desaturate ( ) : Gd Method to desaturate the image.
destroy ( boolean $file = false ) : void Destroy the image object and the related image file directly.
diffuse ( integer $radius ) : Gd Dummy method to match the Imagick API.
drawArc ( integer $x, integer $y, integer $start, integer $end, integer $w, integer $h = null ) : Gd Method to add an arc to the image.
drawCircle ( integer $x, integer $y, integer $w ) : Gd Method to add a circle to the image.
drawEllipse ( integer $x, integer $y, integer $w, integer $h = null ) : Gd Method to add an ellipse to the image.
drawLine ( integer $x1, integer $y1, integer $x2, integer $y2 ) : Gd Method to add a line to the image.
drawPolygon ( array $points ) : Gd Method to add a polygon to the image.
drawRectangle ( integer $x, integer $y, integer $w, integer $h = null ) : Gd Method to add a rectangle to the image.
drawSquare ( integer $x, integer $y, integer $w ) : Gd Method to add a square to the image.
flatten ( ) : Gd Dummy method to match the Imagick API.
flip ( ) : Gd Method to flip the image over the x-axis.
flop ( ) : Gd Method to flip the image over the y-axis.
formats ( ) : array Get formats
getColors ( integer | string $format = Pop\Image\Gd::HEX ) : array Return all of the colors in the palette in an array format
getFormats ( ) : array Get the array of supported formats of Imagick.
getNumberOfFormats ( ) : integer Get the number of supported formats of Imagick.
hsb ( integer $h, integer $s, integer $b ) : Gd Dummy method to match the Imagick API.
hue ( integer $h ) : Gd Dummy method to match the Imagick API.
invert ( ) : Gd Method to invert the image (create a negative.)
isInstalled ( ) : boolean Check if GD is installed.
level ( integer $black, float $gamma, integer $white ) : Gd Dummy method to match the Imagick API.
noise ( integer $type ) : Gd Dummy method to match the Imagick API.
output ( boolean $download = false ) : Gd Output the image object directly.
overlay ( string $ovr, integer | string $x, integer | string $y ) : Gd Overlay an image onto the current image.
paint ( integer $radius ) : Gd Dummy method to match the Imagick API.
pencil ( ) : Gd Apply a pencil/sketch effect to the image
pixelate ( integer $px ) : Gd Apply a mosiac pixelate effect to the image
posterize ( integer $levels, boolean $dither = false ) : Gd Dummy method to match the Imagick API.
resize ( integer | string $px ) : Gd Resize the image object to the largest dimension
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.
resource ( ) : resource Get the image resource to directly interact with it
rotate ( integer | string $deg ) : Gd Rotate the image object, using simple degrees, i.e. -90, to rotate the image.
saturation ( integer $s ) : Gd Dummy method to match the Imagick API.
save ( string $to = null, boolean $append = false ) : Gd Save the image object to disk.
scale ( float | string $scl ) : Gd Scale the image object
setBlur ( integer | string $blur = null ) : Imagick Dummy method to match the Imagick API.
setCompression ( mixed $comp = null ) : Imagick Set the image compression quality.
setFilter ( integer | string $filter = null ) : Gd Dummy method to match the Imagick API.
setFormats ( ) : Gd Dummy method to match the Imagick API.
setOpacity ( integer | string $opac ) : Gd Set the opacity.
setOverlay ( integer | string $ovr = null ) : Imagick Dummy method to match the Imagick API.
setQuality ( mixed $q = null ) : Gd Set the image quality based on the type of image.
sharpen ( integer $amount ) : Gd Method to sharpen the image.
skew ( Pop\Color\Space\ColorInterface $color, integer $x, integer $y ) : Gd Dummy method to match the Imagick API.
swirl ( integer $degrees ) : Gd Dummy method to match the Imagick API.
text ( string $str, integer | string $size, integer | string $x, integer | string $y, string $font = null, integer | string $rotate = null, boolean $stroke = false ) : Gd Create text within the an image object
wave ( integer $amp, integer $length ) : Gd Dummy method to match the Imagick API.

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

Метод Описание
copyImage ( integer | string $w, integer | string $h, integer | string $x, integer | string $y ) : void Copy the image resource to the image output resource with the set parameters.
createImage ( string $new, string $img = null, integer | string $q = null ) : void Create and save the new image file in the correct format.
createResource ( ) : void Create a new image resource based on the current image type of the image object.
getInfo ( ) : void Get GD Info.
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 ) : Gd
$img string
$w integer | string
$h integer | string
$color Pop\Color\Space\ColorInterface
$types array
Результат Gd

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

Destructor to destroy the image resource
public __destruct ( ) : void
Результат void

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

To string method to output the image
public __toString ( ) : string
Результат string

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

Method to blur the image.
public blur ( integer $amount, integer $type = Gd::GAUSSIAN_BLUR ) : Gd
$amount integer
$type integer
Результат Gd

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

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

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

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

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

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

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

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

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

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

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

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

copyImage() защищенный Метод

Copy the image resource to the image output resource with the set parameters.
protected copyImage ( integer | string $w, integer | string $h, integer | string $x, integer | string $y ) : void
$w integer | string
$h integer | string
$x integer | string
$y integer | string
Результат void

createImage() защищенный Метод

Create and save the new image file in the correct format.
protected createImage ( string $new, string $img = null, integer | string $q = null ) : void
$new string
$img string
$q integer | string
Результат void

createResource() защищенный Метод

Create a new image resource based on the current image type of the image object.
protected createResource ( ) : void
Результат void

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

Crop the image object
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
public cropThumb ( integer | string $px, integer | string $x, integer | string $y ) : Gd
$px integer | string
$x integer | string
$y integer | string
Результат Gd

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

Method to desaturate the image.
public desaturate ( ) : Gd
Результат Gd

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

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

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

This method doesn't do anything
public diffuse ( integer $radius ) : Gd
$radius integer
Результат Gd

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

This method doesn't do anything
public flatten ( ) : Gd
Результат Gd

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

Method to flip the image over the x-axis.
public flip ( ) : Gd
Результат Gd

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

Method to flip the image over the y-axis.
public flop ( ) : Gd
Результат Gd

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

Get formats
public static formats ( ) : array
Результат array

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

Return all of the colors in the palette in an array format
public getColors ( integer | string $format = Pop\Image\Gd::HEX ) : array
$format integer | string
Результат array

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

Get the array of supported formats of Imagick.
public getFormats ( ) : array
Результат array

getInfo() защищенный Метод

Get GD Info.
protected getInfo ( ) : void
Результат void

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

Get the number of supported formats of Imagick.
public getNumberOfFormats ( ) : integer
Результат integer

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

This method doesn't do anything
public hsb ( integer $h, integer $s, integer $b ) : Gd
$h integer
$s integer
$b integer
Результат Gd

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

This method doesn't do anything
public hue ( integer $h ) : Gd
$h integer
Результат Gd

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

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

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

Check if GD is installed.
public static isInstalled ( ) : boolean
Результат boolean

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

This method doesn't do anything
public level ( integer $black, float $gamma, integer $white ) : Gd
$black integer
$gamma float
$white integer
Результат Gd

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

This method doesn't do anything
public noise ( integer $type ) : Gd
$type integer
Результат Gd

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

Output the image object directly.
public output ( boolean $download = false ) : Gd
$download boolean
Результат Gd

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

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

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

This method doesn't do anything
public paint ( integer $radius ) : Gd
$radius integer
Результат Gd

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

Apply a pencil/sketch effect to the image
public pencil ( ) : Gd
Результат Gd

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

Apply a mosiac pixelate effect to the image
public pixelate ( integer $px ) : Gd
$px integer
Результат Gd

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

This method doesn't do anything
public posterize ( integer $levels, boolean $dither = false ) : Gd
$levels integer
$dither boolean
Результат Gd

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

Resize the image object to the largest dimension
public resize ( integer | string $px ) : Gd
$px integer | string
Результат Gd

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

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

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

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

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

Get the image resource to directly interact with it
public resource ( ) : resource
Результат resource

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

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

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

This method doesn't do anything
public saturation ( integer $s ) : Gd
$s integer
Результат Gd

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

Save the image object to disk.
public save ( string $to = null, boolean $append = false ) : Gd
$to string
$append boolean
Результат Gd

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

Scale the image object
public scale ( float | string $scl ) : Gd
$scl float | string
Результат Gd

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

This method doesn't do anything
public setBlur ( integer | string $blur = null ) : Imagick
$blur integer | string
Результат Imagick

setColor() защищенный Метод

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

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

Alias to setQuality()
public setCompression ( mixed $comp = null ) : Imagick
$comp mixed
Результат Imagick

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

This method doesn't do anything
public setFilter ( integer | string $filter = null ) : Gd
$filter integer | string
Результат Gd

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

This method doesn't do anything
public setFormats ( ) : Gd
Результат Gd

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

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

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

This method doesn't do anything
public setOverlay ( integer | string $ovr = null ) : Imagick
$ovr integer | string
Результат Imagick

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

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

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

Method to sharpen the image.
public sharpen ( integer $amount ) : Gd
$amount integer
Результат Gd

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

This method doesn't do anything
public skew ( Pop\Color\Space\ColorInterface $color, integer $x, integer $y ) : Gd
$color Pop\Color\Space\ColorInterface
$x integer
$y integer
Результат Gd

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

This method doesn't do anything
public swirl ( integer $degrees ) : Gd
$degrees integer
Результат Gd

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

Create text within the an image object
public text ( string $str, integer | string $size, integer | string $x, integer | string $y, string $font = null, integer | string $rotate = null, boolean $stroke = false ) : Gd
$str string
$size integer | string
$x integer | string
$y integer | string
$font string
$rotate integer | string
$stroke boolean
Результат Gd

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

This method doesn't do anything
public wave ( integer $amp, integer $length ) : Gd
$amp integer
$length integer
Результат Gd

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

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

Array of allowed file types.
protected array $allowed
Результат array

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

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