Class Image (namespace Nette)
Basic manipulation with images.
Object | --Image
Direct Known Sub-classes:
Public Method Summary | |
---|---|
Image |
__construct
(resource $image)
Wraps GD image.
|
static array |
calculateSize
(mixed $srcWidth, mixed $srcHeight, mixed $newWidth, mixed $newHeight, [int $flags =
self::FIT ])
Calculates dimensions of resized image.
|
Image |
crop
(mixed $left, mixed $top, int $width, int $height)
Crops image.
|
static Image |
fromBlank
(int $width, int $height, [array $color =
NULL ])
Creates blank image.
|
static Image |
fromFile
(string $file, [mixed &$format =
NULL ])
Opens image from file.
|
static Image |
fromString
(string $s, [mixed &$format =
NULL ])
Create a new image from the image stream in the string.
|
int |
getHeight
()
Returns image height.
|
resource |
Returns image GD resource.
|
int |
getWidth
()
Returns image width.
|
Image |
Puts another image into this image.
|
Image |
resize
(mixed $width, mixed $height, [int $flags =
self::FIT ])
Resizes image.
|
static array |
rgb
(int $red, int $green, int $blue, [int $transparency =
0 ])
Returns RGB color.
|
bool |
Saves image to the file.
|
bool |
Outputs image to browser.
|
Image |
sharpen
()
Sharpen image.
|
string |
Outputs image to string.
|
mixed |
__call
(string $name, array $args)
Call to undefined method.
|
string |
__toString
()
Outputs image to string.
|
Protected Method Summary | |
---|---|
protected Image |
setImageResource
(resource $image)
Sets image resource.
|
Methods Inherited From Object |
---|
extensionMethod(), getClass(), getReflection(), __call(), __callStatic(), __get(), __isset(), __set(), __unset() |
Constant Summary | |||
---|---|---|---|
string | EMPTY_GIF |
... |
line 52 |
int | ENLARGE |
1 |
line 35 resize() allows enlarging image (it only shrinks images by default) |
int | FILL |
4 |
line 44 resize() fills (and even overflows) given area |
int | FIT |
0 |
line 41 resize() fits in given area |
string | GIF |
IMAGETYPE_GIF |
line 49 |
string | JPEG |
IMAGETYPE_JPEG |
line 47 |
string | PNG |
IMAGETYPE_PNG |
line 48 |
int | STRETCH |
2 |
line 38 resize() will ignore aspect ratio |
Variable Summary | ||||
---|---|---|---|---|
static bool | $useImageMagick | FALSE |
line 55 |
Method Details | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
line 184 __constructpublic Image __construct (resource $image) Wraps GD image. Overridden in child classes as:
|
||||||||||||||||||||||||
line 284 calculateSizepublic static array calculateSize (mixed $srcWidth, mixed $srcHeight, mixed $newWidth, mixed $newHeight, [int $flags = Calculates dimensions of resized image.
|
||||||||||||||||||||||||
line 351 croppublic Image crop (mixed $left, mixed $top, int $width, int $height) Crops image. Overridden in child classes as:
|
||||||||||||||||||||||||
line 155 fromBlankpublic static Image fromBlank (int $width, int $height, [array $color = Creates blank image.
|
||||||||||||||||||||||||
line 88 fromFilepublic static Image fromFile (string $file, [mixed &$format = Opens image from file.
|
||||||||||||||||||||||||
line 125 fromStringpublic static Image fromString (string $s, [mixed &$format = Create a new image from the image stream in the string.
|
||||||||||||||||||||||||
line 206 getHeightpublic int getHeight () Returns image height. Overridden in child classes as:
|
||||||||||||||||||||||||
line 233 getImageResourcepublic resource getImageResource () Returns image GD resource. Overridden in child classes as:
|
||||||||||||||||||||||||
line 195 getWidthpublic int getWidth () Returns image width. Overridden in child classes as:
|
||||||||||||||||||||||||
line 398 placepublic Image place (Image $image, [mixed $left = Puts another image into this image.
|
||||||||||||||||||||||||
line 247 resizepublic Image resize (mixed $width, mixed $height, [int $flags = Resizes image. Overridden in child classes as:
|
||||||||||||||||||||||||
line 70 rgbpublic static array rgb (int $red, int $green, int $blue, [int $transparency = Returns RGB color.
|
||||||||||||||||||||||||
line 428 savepublic bool save ([string $file = Saves image to the file. Overridden in child classes as:
|
||||||||||||||||||||||||
line 500 sendpublic bool send ([int $type = Outputs image to browser.
|
||||||||||||||||||||||||
line 218 setImageResourceprotected Image setImageResource (resource $image) Sets image resource.
|
||||||||||||||||||||||||
line 378 sharpenpublic Image sharpen () Sharpen image.
|
||||||||||||||||||||||||
line 469 toStringpublic string toString ([int $type = Outputs image to string.
|
||||||||||||||||||||||||
line 519 __callpublic mixed __call (string $name, array $args) Call to undefined method.
|
||||||||||||||||||||||||
line 482 __toStringpublic string __toString () Outputs image to string.
|