There is no license information available for the latest version (1.4) of this package.

1.4 2014-02-26 20:22 UTC


#Croogo Image2 plugin for Croogo 1.4+

This helper is modification of original Image helper boundled with Croogo. This version support method chaining and watermark image


  • gdlib2


  • download and copy this plugin to app/Plugin/Image2
  • activate plugin in administration Extesions -> Plugins
  • create folder for resized images, default is app/webroot/uploads/resized. You can change it in plugin bootstrap.php
  • folder must have write permission

Example usage


Classic "hard" resize

          ->resizeit(50, 50, false)
          ->imagePath();  // return /uploads/resized/0_0_50_50_resize_screenshot.png

Ratio resize

          ->resizeit(50, 50, true)
          ->imagePath();  // return /uploads/resized/0_0_50_38_resize_screenshot.png


Crop direct from original image

          ->crop(200, 100, false)
          ->imagePath(); // return /uploads/resized/150_200_200_200_crop_screenshot.png

Resize image to longer side and then crop

          ->crop(200, 100)
          ->imagePath(); // return /uploads/resized/0_38_200_200_crop_screenshot.png


Watermark image in PNG format, support for alpha channel.

   $this-Image2->watermark($watermark_image, $position, $watermark_absolute_path)
  • $watermark_image = path to watermark image

  • $position = position of watermark

  • $watermark_absolute_path = true if $watermark_image is absolute path

    $this->Image2->source('img/screenshot.png', 'center')
           ->resizeit(500, 500, false)
           ->watermark('img/croogo.png', 'center', false)
           ->imagePath() // return /uploads/resized/croogo_png_center_0_0_500_500_resize_screenshot.png


  • center - center of the image, long size 70% of original image long side
  • overlay - watermark image is resized to equal sizes as original
  • pattern - watermark is croped to equal sizes as original, assume big pattern watermark
  • left bottom - not implemented yet
  • right bottom - not implemented yet
  • left top - not implemented yet
  • right top - not implemented yet

Inline image

Base64 encoded inline image

          ->crop(200, 100, false)
          ->inlineImage();  // return 'data:image/png;base64,i3fs.....'

Backward compatibility

"resize" method from previous version is supported

   $this->Image2->resize($path, $width, $height, $method = 'resizeRatio', $htmlAttributes = array(), $return = false, $server_path = false);