Image
class Image extends Object
Basic manipulation with images.
$image = Image::fromFile('nette.jpg');
$image->resize(150, 100);
$image->sharpen();
$image->send();
Constants
SHRINK_ONLY |
resize() only shrinks images |
STRETCH |
resize() will ignore aspect ratio |
FIT |
resize() fits in given area so its dimensions are less than or equal to the required dimensions |
FILL |
resize() fills given area so its dimensions are greater than or equal to the required dimensions |
EXACT |
resize() fills given area exactly |
JPEG |
|
PNG |
|
GIF |
|
EMPTY_GIF |
|
deprecated ENLARGE |
|
Properties
int read-only | $width | ||
int read-only | $height | ||
resource read-only | $imageResource |
Methods
Returns RGB color.
Get format from the image stream in the string.
Create a new image from the image stream in the string.
Wraps GD image.
Returns image width.
Returns image height.
Sets image resource.
Returns image GD resource.
Calculates dimensions of resized image.
Calculates dimensions of cutout in image.
Saves image to the file.
Outputs image to string.
Outputs image to string.
Outputs image to browser.
Call to undefined method.
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
Details
at line 125
static array
rgb($red, $green, $blue, $transparency = 0)
Returns RGB color.
at line 144
static Image
fromFile($file, $format = NULL)
Opens image from file.
at line 173
static mixed
getFormatFromString($s)
Get format from the image stream in the string.
at line 188
static Image
fromString($s, $format = NULL)
Create a new image from the image stream in the string.
at line 207
static Image
fromBlank($width, $height, $color = NULL)
Creates blank image.
at line 235
__construct($image)
Wraps GD image.
at line 246
int
getWidth()
Returns image width.
at line 256
int
getHeight()
Returns image height.
at line 267
protected Image
setImageResource($image)
Sets image resource.
at line 281
resource
getImageResource()
Returns image GD resource.
at line 294
Image
resize($width, $height, $flags = self::FIT)
Resizes image.
at line 334
static array
calculateSize($srcWidth, $srcHeight, $newWidth, $newHeight, $flags = self::FIT)
Calculates dimensions of resized image.
at line 399
Image
crop($left, $top, $width, $height)
Crops image.
at line 419
static array
calculateCutout($srcWidth, $srcHeight, $left, $top, $newWidth, $newHeight)
Calculates dimensions of cutout in image.
at line 451
Image
sharpen()
Sharpen image.
at line 470
Image
place(Image $image, $left = 0, $top = 0, $opacity = 100)
Puts another image into this image.
at line 516
bool
save($file = NULL, $quality = NULL, $type = NULL)
Saves image to the file.
at line 556
string
toString($type = self::JPEG, $quality = NULL)
Outputs image to string.
at line 568
string
__toString()
Outputs image to string.
at line 590
bool
send($type = self::JPEG, $quality = NULL)
Outputs image to browser.
at line 608
mixed
__call($name, $args)
Call to undefined method.
at line 636
__clone()
No description
at line 86
void
alphaBlending(bool $on)
No description
at line 86
void
antialias(bool $on)
No description
at line 86
void
arc(mixed $x, mixed $y, mixed $w, mixed $h, mixed $start, mixed $end, mixed $color)
No description
at line 86
void
char(int $font, mixed $x, mixed $y, string $char, mixed $color)
No description
at line 86
void
charUp(int $font, mixed $x, mixed $y, string $char, mixed $color)
No description
at line 86
int
colorAllocate(mixed $red, mixed $green, mixed $blue)
No description
at line 86
int
colorAllocateAlpha(mixed $red, mixed $green, mixed $blue, mixed $alpha)
No description
at line 86
int
colorAt(mixed $x, mixed $y)
No description
at line 86
int
colorClosest(mixed $red, mixed $green, mixed $blue)
No description
at line 86
int
colorClosestAlpha(mixed $red, mixed $green, mixed $blue, mixed $alpha)
No description
at line 86
int
colorClosestHWB(mixed $red, mixed $green, mixed $blue)
No description
at line 86
void
colorDeallocate(mixed $color)
No description
at line 86
int
colorExact(mixed $red, mixed $green, mixed $blue)
No description
at line 86
int
colorExactAlpha(mixed $red, mixed $green, mixed $blue, mixed $alpha)
No description
at line 86
void
colorMatch(Image $image2)
No description
at line 86
int
colorResolve(mixed $red, mixed $green, mixed $blue)
No description
at line 86
int
colorResolveAlpha(mixed $red, mixed $green, mixed $blue, mixed $alpha)
No description
at line 86
void
colorSet(mixed $index, mixed $red, mixed $green, mixed $blue)
No description
at line 86
array
colorsForIndex(mixed $index)
No description
at line 86
int
colorsTotal()
No description
at line 86
int
colorTransparent(mixed $color)
No description
at line 86
void
convolution(array $matrix, float $div, float $offset)
No description
at line 86
void
copy(Image $src, mixed $dstX, mixed $dstY, mixed $srcX, mixed $srcY, mixed $srcW, mixed $srcH)
No description
at line 86
void
copyMerge(Image $src, mixed $dstX, mixed $dstY, mixed $srcX, mixed $srcY, mixed $srcW, mixed $srcH, mixed $opacity)
No description
at line 86
void
copyMergeGray(Image $src, mixed $dstX, mixed $dstY, mixed $srcX, mixed $srcY, mixed $srcW, mixed $srcH, mixed $opacity)
No description
at line 86
void
copyResampled(Image $src, mixed $dstX, mixed $dstY, mixed $srcX, mixed $srcY, mixed $dstW, mixed $dstH, mixed $srcW, mixed $srcH)
No description
at line 86
void
copyResized(Image $src, mixed $dstX, mixed $dstY, mixed $srcX, mixed $srcY, mixed $dstW, mixed $dstH, mixed $srcW, mixed $srcH)
No description
at line 86
void
dashedLine(mixed $x1, mixed $y1, mixed $x2, mixed $y2, mixed $color)
No description
at line 86
void
ellipse(mixed $cx, mixed $cy, mixed $w, mixed $h, mixed $color)
No description
at line 86
void
fill(mixed $x, mixed $y, mixed $color)
No description
at line 86
void
filledArc(mixed $cx, mixed $cy, mixed $w, mixed $h, mixed $s, mixed $e, mixed $color, mixed $style)
No description
at line 86
void
filledEllipse(mixed $cx, mixed $cy, mixed $w, mixed $h, mixed $color)
No description
at line 86
void
filledPolygon(array $points, mixed $numPoints, mixed $color)
No description
at line 86
void
filledRectangle(mixed $x1, mixed $y1, mixed $x2, mixed $y2, mixed $color)
No description
at line 86
void
fillToBorder(mixed $x, mixed $y, mixed $border, mixed $color)
No description
at line 86
void
filter(mixed $filtertype)
No description
at line 86
array
ftText(mixed $size, mixed $angle, mixed $x, mixed $y, mixed $col, string $fontFile, string $text, array $extrainfo = NULL)
No description
at line 86
void
gammaCorrect(float $inputgamma, float $outputgamma)
No description
at line 86
int
interlace(mixed $interlace)
No description
at line 86
bool
isTrueColor()
No description
at line 86
void
layerEffect(mixed $effect)
No description
at line 86
void
line(mixed $x1, mixed $y1, mixed $x2, mixed $y2, mixed $color)
No description
at line 86
void
paletteCopy(Image $source)
No description
at line 86
void
polygon(array $points, mixed $numPoints, mixed $color)
No description
at line 86
array
psText(string $text, mixed $font, mixed $size, mixed $color, mixed $backgroundColor, mixed $x, mixed $y, mixed $space, mixed $tightness, float $angle = NULL, mixed $antialiasSteps)
No description
at line 86
void
rectangle(mixed $x1, mixed $y1, mixed $x2, mixed $y2, mixed $col)
No description
at line 86
Image
rotate(float $angle, mixed $backgroundColor)
No description
at line 86
void
saveAlpha(bool $saveflag)
No description
at line 86
void
setBrush(Image $brush)
No description
at line 86
void
setPixel(mixed $x, mixed $y, mixed $color)
No description
at line 86
void
setStyle(array $style)
No description
at line 86
void
setThickness(mixed $thickness)
No description
at line 86
void
setTile(Image $tile)
No description
at line 86
void
string(mixed $font, mixed $x, mixed $y, string $s, mixed $col)
No description
at line 86
void
stringUp(mixed $font, mixed $x, mixed $y, string $s, mixed $col)
No description
at line 86
void
trueColorToPalette(bool $dither, mixed $ncolors)
No description
at line 86
array
ttfText(mixed $size, mixed $angle, mixed $x, mixed $y, mixed $color, string $fontfile, string $text)
No description