Class ImageMagick (namespace Nette)


Manipulation with large images using ImageMagick.

  1. 1:  $image Image::fromFile('bigphoto.jpg');
  2. 2:  $image->resize(150100);
  3. 3:  $image->sharpen();
  4. 4:  $image->send();

Object
   |
   --Image
      |
      --ImageMagick
Copyright: Copyright (c) 2004, 2010 David Grudl
Located: in /ImageMagick.php (line 28)
Public Method Summary
ImageMagick
__construct (string $file, [string &$format = NULL])
Wraps image file.
void
Delete temporary files.
ImageMagick
crop (int $left, int $top, int $width, int $height)
Crops image.
int
Returns image height.
resource
Returns image GD resource.
int
Returns image width.
ImageMagick
resize (mixed $width, mixed $height, [int $flags = self::FIT])
Resizes image.
bool
save ([string $file = NULL], [int $quality = NULL], [int $type = NULL])
Saves image to the file.
Methods Inherited From Image
__construct(), calculateSize(), crop(), fromBlank(), fromFile(), fromString(), getHeight(), getImageResource(), getWidth(), place(), resize(), rgb(), save(), send(), setImageResource(), sharpen(), toString(), __call(), __toString()
Methods Inherited From Object
extensionMethod(), getClass(), getReflection(), __call(), __callStatic(), __get(), __isset(), __set(), __unset()
Constant Summary
Constants Inherited From Image
EMPTY_GIF, ENLARGE, FILL, FIT, GIF, JPEG, PNG, STRETCH
Variable Summary
static string $path ''

line 31

path to ImageMagick library
static string $tempDir

line 34


Method Details

line 55

__construct

public ImageMagick __construct (string $file, [string &$format = NULL])

Wraps image file.

Input
string $file detected image format
string &$format
Output
ImageMagick  

line 242

__destruct

public void __destruct ()

Delete temporary files.

Output
void  

line 143

crop

public ImageMagick crop (int $left, int $top, int $width, int $height)

Crops image.

Input
int $left x-coordinate
int $top y-coordinate
int $width width
int $height height
Output
ImageMagick provides a fluent interface

line 83

getHeight

public int getHeight ()

Returns image height.

Output
int  

line 94

getImageResource

public resource getImageResource ()

Returns image GD resource.

Output
resource  

line 72

getWidth

public int getWidth ()

Returns image width.

Output
int  

line 119

resize

public ImageMagick resize (mixed $width, mixed $height, [int $flags = self::FIT])

Resizes image.

Input
mixed $width width in pixels or percent
mixed $height height in pixels or percent
int $flags flags
Output
ImageMagick provides a fluent interface

line 166

save

public bool save ([string $file = NULL], [int $quality = NULL], [int $type = NULL])

Saves image to the file.

Input
string $file filename
int $quality quality 0..100 (for JPEG and PNG)
int $type optional image type
Output
bool TRUE on success or FALSE on failure.