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
Author: David Grudl
Copyright: Copyright (c) 2004, 2009 David Grudl
Located: in /ImageMagick.php (line 41)
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 $newWidth, mixed $newHeight, [int $flags = 0])
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, GIF, JPEG, PNG, STRETCH
Variable Summary
static string $path ''

line 44

path to ImageMagick library
static string $tempDir

line 47


Method Details

line 68

__construct

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

Wraps image file.

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

line 252

__destruct

public void __destruct ()

Delete temporary files.

Output
void  

line 153

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 96

getHeight

public int getHeight ()

Returns image height.

Output
int  

line 107

getImageResource

public resource getImageResource ()

Returns image GD resource.

Output
resource  

line 85

getWidth

public int getWidth ()

Returns image width.

Output
int  

line 132

resize

public ImageMagick resize (mixed $newWidth, mixed $newHeight, [int $flags = 0])

Resizes image.

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

line 176

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.