Namespaces

  • Nette
    • Application
      • Diagnostics
      • Responses
      • Routers
      • UI
    • Caching
      • Storages
    • ComponentModel
    • Config
      • Adapters
      • Extensions
    • Database
      • Diagnostics
      • Drivers
      • Reflection
      • Table
    • DI
      • Diagnostics
    • Diagnostics
    • Forms
      • Controls
      • Rendering
    • Http
    • Iterators
    • Latte
      • Macros
    • Loaders
    • Localization
    • Mail
    • Reflection
    • Security
      • Diagnostics
    • Templating
    • Utils
      • PhpGenerator
  • NetteModule
  • None
  • PHP

Classes

  • ArrayHash
  • ArrayList
  • Callback
  • DateTime
  • Framework
  • FreezableObject
  • Image
  • Object
  • ObjectMixin

Interfaces

  • IFreezable

Exceptions

  • ArgumentOutOfRangeException
  • DeprecatedException
  • DirectoryNotFoundException
  • FatalErrorException
  • FileNotFoundException
  • InvalidArgumentException
  • InvalidStateException
  • IOException
  • MemberAccessException
  • NotImplementedException
  • NotSupportedException
  • OutOfRangeException
  • StaticClassException
  • UnexpectedValueException
  • UnknownImageFileException
  • Overview
  • Namespace
  • Class
  • Tree
  1: <?php
  2: 
  3: /**
  4:  * This file is part of the Nette Framework (http://nette.org)
  5:  *
  6:  * Copyright (c) 2004 David Grudl (http://davidgrudl.com)
  7:  *
  8:  * For the full copyright and license information, please view
  9:  * the file license.txt that was distributed with this source code.
 10:  */
 11: 
 12: namespace Nette;
 13: 
 14: use Nette;
 15: 
 16: 
 17: 
 18: /**
 19:  * Basic manipulation with images.
 20:  *
 21:  * <code>
 22:  * $image = Image::fromFile('nette.jpg');
 23:  * $image->resize(150, 100);
 24:  * $image->sharpen();
 25:  * $image->send();
 26:  * </code>
 27:  *
 28:  * @author     David Grudl
 29:  *
 30:  * @method void alphaBlending(bool $on)
 31:  * @method void antialias(bool $on)
 32:  * @method void arc($x, $y, $w, $h, $s, $e, $color)
 33:  * @method void char($font, $x, $y, $char, $color)
 34:  * @method void charUp($font, $x, $y, $char, $color)
 35:  * @method int colorAllocate($red, $green, $blue)
 36:  * @method int colorAllocateAlpha($red, $green, $blue, $alpha)
 37:  * @method int colorAt($x, $y)
 38:  * @method int colorClosest($red, $green, $blue)
 39:  * @method int colorClosestAlpha($red, $green, $blue, $alpha)
 40:  * @method int colorClosestHWB($red, $green, $blue)
 41:  * @method void colorDeallocate($color)
 42:  * @method int colorExact($red, $green, $blue)
 43:  * @method int colorExactAlpha($red, $green, $blue, $alpha)
 44:  * @method void colorMatch(Image $image2)
 45:  * @method int colorResolve($red, $green, $blue)
 46:  * @method int colorResolveAlpha($red, $green, $blue, $alpha)
 47:  * @method void colorSet($index, $red, $green, $blue)
 48:  * @method array colorsForIndex($index)
 49:  * @method int colorsTotal()
 50:  * @method int colorTransparent([$color])
 51:  * @method void convolution(array $matrix, float $div, float $offset)
 52:  * @method void copy(Image $src, $dstX, $dstY, $srcX, $srcY, $srcW, $srcH)
 53:  * @method void copyMerge(Image $src, $dstX, $dstY, $srcX, $srcY, $srcW, $srcH, $opacity)
 54:  * @method void copyMergeGray(Image $src, $dstX, $dstY, $srcX, $srcY, $srcW, $srcH, $opacity)
 55:  * @method void copyResampled(Image $src, $dstX, $dstY, $srcX, $srcY, $dstW, $dstH, $srcW, $srcH)
 56:  * @method void copyResized(Image $src, $dstX, $dstY, $srcX, $srcY, $dstW, $dstH, $srcW, $srcH)
 57:  * @method void dashedLine($x1, $y1, $x2, $y2, $color)
 58:  * @method void ellipse($cx, $cy, $w, $h, $color)
 59:  * @method void fill($x, $y, $color)
 60:  * @method void filledArc($cx, $cy, $w, $h, $s, $e, $color, $style)
 61:  * @method void filledEllipse($cx, $cy, $w, $h, $color)
 62:  * @method void filledPolygon(array $points, $numPoints, $color)
 63:  * @method void filledRectangle($x1, $y1, $x2, $y2, $color)
 64:  * @method void fillToBorder($x, $y, $border, $color)
 65:  * @method void filter($filtertype [, ...])
 66:  * @method int fontHeight($font)
 67:  * @method int fontWidth($font)
 68:  * @method array ftBBox($size, $angle, string $fontFile, string $text [, array $extrainfo])
 69:  * @method array ftText($size, $angle, $x, $y, $col, string $fontFile, string $text [, array $extrainfo])
 70:  * @method void gammaCorrect(float $inputgamma, float $outputgamma)
 71:  * @method int interlace([$interlace])
 72:  * @method bool isTrueColor()
 73:  * @method void layerEffect($effect)
 74:  * @method void line($x1, $y1, $x2, $y2, $color)
 75:  * @method int loadFont(string $file)
 76:  * @method void paletteCopy(Image $source)
 77:  * @method void polygon(array $points, $numPoints, $color)
 78:  * @method array psBBox(string $text, $font, $size [, $space] [, $tightness] [, float $angle])
 79:  * @method void psEncodeFont($fontIndex, string $encodingfile)
 80:  * @method void psExtendFont($fontIndex, float $extend)
 81:  * @method void psFreeFont($fontindex)
 82:  * @method resource psLoadFont(string $filename)
 83:  * @method void psSlantFont($fontIndex, float $slant)
 84:  * @method array psText(string $text, $font, $size, $color, $backgroundColor, $x, $y [, $space] [, $tightness] [, float $angle] [, $antialiasSteps])
 85:  * @method void rectangle($x1, $y1, $x2, $y2, $col)
 86:  * @method Image rotate(float $angle, $backgroundColor)
 87:  * @method void saveAlpha(bool $saveflag)
 88:  * @method void setBrush(Image $brush)
 89:  * @method void setPixel($x, $y, $color)
 90:  * @method void setStyle(array $style)
 91:  * @method void setThickness($thickness)
 92:  * @method void setTile(Image $tile)
 93:  * @method void string($font, $x, $y, string $s, $col)
 94:  * @method void stringUp($font, $x, $y, string $s, $col)
 95:  * @method void trueColorToPalette(bool $dither, $ncolors)
 96:  * @method array ttfBBox($size, $angle, string $fontfile, string $text)
 97:  * @method array ttfText($size, $angle, $x, $y, $color, string $fontfile, string $text)
 98:  * @method int types()
 99:  * @property-read int $width
100:  * @property-read int $height
101:  * @property-read resource $imageResource
102:  */
103: class Image extends Object
104: {
105:     /** {@link resize()} only shrinks images */
106:     const SHRINK_ONLY = 1;
107: 
108:     /** {@link resize()} will ignore aspect ratio */
109:     const STRETCH = 2;
110: 
111:     /** {@link resize()} fits in given area so its dimensions are less than or equal to the required dimensions */
112:     const FIT = 0;
113: 
114:     /** {@link resize()} fills given area so its dimensions are greater than or equal to the required dimensions */
115:     const FILL = 4;
116: 
117:     /** {@link resize()} fills given area exactly */
118:     const EXACT = 8;
119: 
120:     /** @int image types {@link send()} */
121:     const JPEG = IMAGETYPE_JPEG,
122:         PNG = IMAGETYPE_PNG,
123:         GIF = IMAGETYPE_GIF;
124: 
125:     const EMPTY_GIF = "GIF89a\x01\x00\x01\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00!\xf9\x04\x01\x00\x00\x00\x00,\x00\x00\x00\x00\x01\x00\x01\x00\x00\x02\x02D\x01\x00;";
126: 
127:     /** @deprecated */
128:     const ENLARGE = 0;
129: 
130:     /** @var resource */
131:     private $image;
132: 
133: 
134: 
135:     /**
136:      * Returns RGB color.
137:      * @param  int  red 0..255
138:      * @param  int  green 0..255
139:      * @param  int  blue 0..255
140:      * @param  int  transparency 0..127
141:      * @return array
142:      */
143:     public static function rgb($red, $green, $blue, $transparency = 0)
144:     {
145:         return array(
146:             'red' => max(0, min(255, (int) $red)),
147:             'green' => max(0, min(255, (int) $green)),
148:             'blue' => max(0, min(255, (int) $blue)),
149:             'alpha' => max(0, min(127, (int) $transparency)),
150:         );
151:     }
152: 
153: 
154: 
155:     /**
156:      * Opens image from file.
157:      * @param  string
158:      * @param  mixed  detected image format
159:      * @return Image
160:      */
161:     public static function fromFile($file, & $format = NULL)
162:     {
163:         if (!extension_loaded('gd')) {
164:             throw new NotSupportedException("PHP extension GD is not loaded.");
165:         }
166: 
167:         $info = @getimagesize($file); // @ - files smaller than 12 bytes causes read error
168: 
169:         switch ($format = $info[2]) {
170:         case self::JPEG:
171:             return new static(imagecreatefromjpeg($file));
172: 
173:         case self::PNG:
174:             return new static(imagecreatefrompng($file));
175: 
176:         case self::GIF:
177:             return new static(imagecreatefromgif($file));
178: 
179:         default:
180:             throw new UnknownImageFileException("Unknown image type or file '$file' not found.");
181:         }
182:     }
183: 
184: 
185: 
186:     /**
187:      * Get format from the image stream in the string.
188:      * @param  string
189:      * @return mixed  detected image format
190:      */
191:     public static function getFormatFromString($s)
192:     {
193:         $types = array('image/jpeg' => self::JPEG, 'image/gif' => self::GIF, 'image/png' => self::PNG);
194:         $type = Utils\MimeTypeDetector::fromString($s);
195:         return isset($types[$type]) ? $types[$type] : NULL;
196:     }
197: 
198: 
199: 
200:     /**
201:      * Create a new image from the image stream in the string.
202:      * @param  string
203:      * @param  mixed  detected image format
204:      * @return Image
205:      */
206:     public static function fromString($s, & $format = NULL)
207:     {
208:         if (!extension_loaded('gd')) {
209:             throw new NotSupportedException("PHP extension GD is not loaded.");
210:         }
211: 
212:         $format = static::getFormatFromString($s);
213: 
214:         return new static(imagecreatefromstring($s));
215:     }
216: 
217: 
218: 
219:     /**
220:      * Creates blank image.
221:      * @param  int
222:      * @param  int
223:      * @param  array
224:      * @return Image
225:      */
226:     public static function fromBlank($width, $height, $color = NULL)
227:     {
228:         if (!extension_loaded('gd')) {
229:             throw new NotSupportedException("PHP extension GD is not loaded.");
230:         }
231: 
232:         $width = (int) $width;
233:         $height = (int) $height;
234:         if ($width < 1 || $height < 1) {
235:             throw new InvalidArgumentException('Image width and height must be greater than zero.');
236:         }
237: 
238:         $image = imagecreatetruecolor($width, $height);
239:         if (is_array($color)) {
240:             $color += array('alpha' => 0);
241:             $color = imagecolorallocatealpha($image, $color['red'], $color['green'], $color['blue'], $color['alpha']);
242:             imagealphablending($image, FALSE);
243:             imagefilledrectangle($image, 0, 0, $width - 1, $height - 1, $color);
244:             imagealphablending($image, TRUE);
245:         }
246:         return new static($image);
247:     }
248: 
249: 
250: 
251:     /**
252:      * Wraps GD image.
253:      * @param  resource
254:      */
255:     public function __construct($image)
256:     {
257:         $this->setImageResource($image);
258:         imagesavealpha($image, TRUE);
259:     }
260: 
261: 
262: 
263:     /**
264:      * Returns image width.
265:      * @return int
266:      */
267:     public function getWidth()
268:     {
269:         return imagesx($this->image);
270:     }
271: 
272: 
273: 
274:     /**
275:      * Returns image height.
276:      * @return int
277:      */
278:     public function getHeight()
279:     {
280:         return imagesy($this->image);
281:     }
282: 
283: 
284: 
285:     /**
286:      * Sets image resource.
287:      * @param  resource
288:      * @return Image  provides a fluent interface
289:      */
290:     protected function setImageResource($image)
291:     {
292:         if (!is_resource($image) || get_resource_type($image) !== 'gd') {
293:             throw new InvalidArgumentException('Image is not valid.');
294:         }
295:         $this->image = $image;
296:         return $this;
297:     }
298: 
299: 
300: 
301:     /**
302:      * Returns image GD resource.
303:      * @return resource
304:      */
305:     public function getImageResource()
306:     {
307:         return $this->image;
308:     }
309: 
310: 
311: 
312:     /**
313:      * Resizes image.
314:      * @param  mixed  width in pixels or percent
315:      * @param  mixed  height in pixels or percent
316:      * @param  int    flags
317:      * @return Image  provides a fluent interface
318:      */
319:     public function resize($width, $height, $flags = self::FIT)
320:     {
321:         if ($flags & self::EXACT) {
322:             return $this->resize($width, $height, self::FILL)->crop('50%', '50%', $width, $height);
323:         }
324: 
325:         list($newWidth, $newHeight) = static::calculateSize($this->getWidth(), $this->getHeight(), $width, $height, $flags);
326: 
327:         if ($newWidth !== $this->getWidth() || $newHeight !== $this->getHeight()) { // resize
328:             $newImage = static::fromBlank($newWidth, $newHeight, self::RGB(0, 0, 0, 127))->getImageResource();
329:             imagecopyresampled(
330:                 $newImage, $this->getImageResource(),
331:                 0, 0, 0, 0,
332:                 $newWidth, $newHeight, $this->getWidth(), $this->getHeight()
333:             );
334:             $this->image = $newImage;
335:         }
336: 
337:         if ($width < 0 || $height < 0) { // flip is processed in two steps for better quality
338:             $newImage = static::fromBlank($newWidth, $newHeight, self::RGB(0, 0, 0, 127))->getImageResource();
339:             imagecopyresampled(
340:                 $newImage, $this->getImageResource(),
341:                 0, 0, $width < 0 ? $newWidth - 1 : 0, $height < 0 ? $newHeight - 1 : 0,
342:                 $newWidth, $newHeight, $width < 0 ? -$newWidth : $newWidth, $height < 0 ? -$newHeight : $newHeight
343:             );
344:             $this->image = $newImage;
345:         }
346:         return $this;
347:     }
348: 
349: 
350: 
351:     /**
352:      * Calculates dimensions of resized image.
353:      * @param  mixed  source width
354:      * @param  mixed  source height
355:      * @param  mixed  width in pixels or percent
356:      * @param  mixed  height in pixels or percent
357:      * @param  int    flags
358:      * @return array
359:      */
360:     public static function calculateSize($srcWidth, $srcHeight, $newWidth, $newHeight, $flags = self::FIT)
361:     {
362:         if (substr($newWidth, -1) === '%') {
363:             $newWidth = round($srcWidth / 100 * abs($newWidth));
364:             $percents = TRUE;
365:         } else {
366:             $newWidth = (int) abs($newWidth);
367:         }
368: 
369:         if (substr($newHeight, -1) === '%') {
370:             $newHeight = round($srcHeight / 100 * abs($newHeight));
371:             $flags |= empty($percents) ? 0 : self::STRETCH;
372:         } else {
373:             $newHeight = (int) abs($newHeight);
374:         }
375: 
376:         if ($flags & self::STRETCH) { // non-proportional
377:             if (empty($newWidth) || empty($newHeight)) {
378:                 throw new InvalidArgumentException('For stretching must be both width and height specified.');
379:             }
380: 
381:             if ($flags & self::SHRINK_ONLY) {
382:                 $newWidth = round($srcWidth * min(1, $newWidth / $srcWidth));
383:                 $newHeight = round($srcHeight * min(1, $newHeight / $srcHeight));
384:             }
385: 
386:         } else {  // proportional
387:             if (empty($newWidth) && empty($newHeight)) {
388:                 throw new InvalidArgumentException('At least width or height must be specified.');
389:             }
390: 
391:             $scale = array();
392:             if ($newWidth > 0) { // fit width
393:                 $scale[] = $newWidth / $srcWidth;
394:             }
395: 
396:             if ($newHeight > 0) { // fit height
397:                 $scale[] = $newHeight / $srcHeight;
398:             }
399: 
400:             if ($flags & self::FILL) {
401:                 $scale = array(max($scale));
402:             }
403: 
404:             if ($flags & self::SHRINK_ONLY) {
405:                 $scale[] = 1;
406:             }
407: 
408:             $scale = min($scale);
409:             $newWidth = round($srcWidth * $scale);
410:             $newHeight = round($srcHeight * $scale);
411:         }
412: 
413:         return array(max((int) $newWidth, 1), max((int) $newHeight, 1));
414:     }
415: 
416: 
417: 
418:     /**
419:      * Crops image.
420:      * @param  mixed  x-offset in pixels or percent
421:      * @param  mixed  y-offset in pixels or percent
422:      * @param  mixed  width in pixels or percent
423:      * @param  mixed  height in pixels or percent
424:      * @return Image  provides a fluent interface
425:      */
426:     public function crop($left, $top, $width, $height)
427:     {
428:         list($left, $top, $width, $height) = static::calculateCutout($this->getWidth(), $this->getHeight(), $left, $top, $width, $height);
429:         $newImage = static::fromBlank($width, $height, self::RGB(0, 0, 0, 127))->getImageResource();
430:         imagecopy($newImage, $this->getImageResource(), 0, 0, $left, $top, $width, $height);
431:         $this->image = $newImage;
432:         return $this;
433:     }
434: 
435: 
436: 
437:     /**
438:      * Calculates dimensions of cutout in image.
439:      * @param  mixed  source width
440:      * @param  mixed  source height
441:      * @param  mixed  x-offset in pixels or percent
442:      * @param  mixed  y-offset in pixels or percent
443:      * @param  mixed  width in pixels or percent
444:      * @param  mixed  height in pixels or percent
445:      * @return array
446:      */
447:     public static function calculateCutout($srcWidth, $srcHeight, $left, $top, $newWidth, $newHeight)
448:     {
449:         if (substr($newWidth, -1) === '%') {
450:             $newWidth = round($srcWidth / 100 * $newWidth);
451:         }
452:         if (substr($newHeight, -1) === '%') {
453:             $newHeight = round($srcHeight / 100 * $newHeight);
454:         }
455:         if (substr($left, -1) === '%') {
456:             $left = round(($srcWidth - $newWidth) / 100 * $left);
457:         }
458:         if (substr($top, -1) === '%') {
459:             $top = round(($srcHeight - $newHeight) / 100 * $top);
460:         }
461:         if ($left < 0) {
462:             $newWidth += $left; $left = 0;
463:         }
464:         if ($top < 0) {
465:             $newHeight += $top; $top = 0;
466:         }
467:         $newWidth = min((int) $newWidth, $srcWidth - $left);
468:         $newHeight = min((int) $newHeight, $srcHeight - $top);
469:         return array($left, $top, $newWidth, $newHeight);
470:     }
471: 
472: 
473: 
474:     /**
475:      * Sharpen image.
476:      * @return Image  provides a fluent interface
477:      */
478:     public function sharpen()
479:     {
480:         imageconvolution($this->getImageResource(), array( // my magic numbers ;)
481:             array( -1, -1, -1 ),
482:             array( -1, 24, -1 ),
483:             array( -1, -1, -1 ),
484:         ), 16, 0);
485:         return $this;
486:     }
487: 
488: 
489: 
490:     /**
491:      * Puts another image into this image.
492:      * @param  Image
493:      * @param  mixed  x-coordinate in pixels or percent
494:      * @param  mixed  y-coordinate in pixels or percent
495:      * @param  int  opacity 0..100
496:      * @return Image  provides a fluent interface
497:      */
498:     public function place(Image $image, $left = 0, $top = 0, $opacity = 100)
499:     {
500:         $opacity = max(0, min(100, (int) $opacity));
501: 
502:         if (substr($left, -1) === '%') {
503:             $left = round(($this->getWidth() - $image->getWidth()) / 100 * $left);
504:         }
505: 
506:         if (substr($top, -1) === '%') {
507:             $top = round(($this->getHeight() - $image->getHeight()) / 100 * $top);
508:         }
509: 
510:         if ($opacity === 100) {
511:             imagecopy(
512:                 $this->getImageResource(), $image->getImageResource(),
513:                 $left, $top, 0, 0, $image->getWidth(), $image->getHeight()
514:             );
515: 
516:         } elseif ($opacity <> 0) {
517:             imagecopymerge(
518:                 $this->getImageResource(), $image->getImageResource(),
519:                 $left, $top, 0, 0, $image->getWidth(), $image->getHeight(),
520:                 $opacity
521:             );
522:         }
523:         return $this;
524:     }
525: 
526: 
527: 
528:     /**
529:      * Saves image to the file.
530:      * @param  string  filename
531:      * @param  int  quality 0..100 (for JPEG and PNG)
532:      * @param  int  optional image type
533:      * @return bool TRUE on success or FALSE on failure.
534:      */
535:     public function save($file = NULL, $quality = NULL, $type = NULL)
536:     {
537:         if ($type === NULL) {
538:             switch (strtolower(pathinfo($file, PATHINFO_EXTENSION))) {
539:             case 'jpg':
540:             case 'jpeg':
541:                 $type = self::JPEG;
542:                 break;
543:             case 'png':
544:                 $type = self::PNG;
545:                 break;
546:             case 'gif':
547:                 $type = self::GIF;
548:             }
549:         }
550: 
551:         switch ($type) {
552:         case self::JPEG:
553:             $quality = $quality === NULL ? 85 : max(0, min(100, (int) $quality));
554:             return imagejpeg($this->getImageResource(), $file, $quality);
555: 
556:         case self::PNG:
557:             $quality = $quality === NULL ? 9 : max(0, min(9, (int) $quality));
558:             return imagepng($this->getImageResource(), $file, $quality);
559: 
560:         case self::GIF:
561:             return $file === NULL ? imagegif($this->getImageResource()) : imagegif($this->getImageResource(), $file); // PHP bug #44591
562: 
563:         default:
564:             throw new InvalidArgumentException("Unsupported image type.");
565:         }
566:     }
567: 
568: 
569: 
570:     /**
571:      * Outputs image to string.
572:      * @param  int  image type
573:      * @param  int  quality 0..100 (for JPEG and PNG)
574:      * @return string
575:      */
576:     public function toString($type = self::JPEG, $quality = NULL)
577:     {
578:         ob_start();
579:         $this->save(NULL, $quality, $type);
580:         return ob_get_clean();
581:     }
582: 
583: 
584: 
585:     /**
586:      * Outputs image to string.
587:      * @return string
588:      */
589:     public function __toString()
590:     {
591:         try {
592:             return $this->toString();
593: 
594:         } catch (\Exception $e) {
595:             Diagnostics\Debugger::toStringException($e);
596:         }
597:     }
598: 
599: 
600: 
601:     /**
602:      * Outputs image to browser.
603:      * @param  int  image type
604:      * @param  int  quality 0..100 (for JPEG and PNG)
605:      * @return bool TRUE on success or FALSE on failure.
606:      */
607:     public function send($type = self::JPEG, $quality = NULL)
608:     {
609:         if ($type !== self::GIF && $type !== self::PNG && $type !== self::JPEG) {
610:             throw new InvalidArgumentException("Unsupported image type.");
611:         }
612:         header('Content-Type: ' . image_type_to_mime_type($type));
613:         return $this->save(NULL, $quality, $type);
614:     }
615: 
616: 
617: 
618:     /**
619:      * Call to undefined method.
620:      *
621:      * @param  string  method name
622:      * @param  array   arguments
623:      * @return mixed
624:      * @throws MemberAccessException
625:      */
626:     public function __call($name, $args)
627:     {
628:         $function = 'image' . $name;
629:         if (function_exists($function)) {
630:             foreach ($args as $key => $value) {
631:                 if ($value instanceof self) {
632:                     $args[$key] = $value->getImageResource();
633: 
634:                 } elseif (is_array($value) && isset($value['red'])) { // rgb
635:                     $args[$key] = imagecolorallocatealpha(
636:                         $this->getImageResource(),
637:                         $value['red'], $value['green'], $value['blue'], $value['alpha']
638:                     );
639:                 }
640:             }
641:             array_unshift($args, $this->getImageResource());
642: 
643:             $res = call_user_func_array($function, $args);
644:             return is_resource($res) && get_resource_type($res) === 'gd' ? $this->setImageResource($res) : $res;
645:         }
646: 
647:         return parent::__call($name, $args);
648:     }
649: 
650: }
651: 
652: 
653: 
654: /**
655:  * The exception that indicates invalid image file.
656:  */
657: class UnknownImageFileException extends \Exception
658: {
659: }
660: 
Nette Framework 2.0.4 API API documentation generated by ApiGen 2.7.0