SproutCMS

This is the code documentation for the SproutCMS project

class Image

Manipulate images using standard methods such as resize, crop, rotate, etc.
This class must be re-initialized for every image you wish to manipulate.

Extending this class

<?php
/**
* New class description goes here
* 
* @author Your Name, 2026-09-16
**/
class NewClassName extends Image {
    
    /**
    * Adds text to the base of an image, e.g. for copyright credit
    **/
    public function addText (string $text) {
        // Method code goes here
    }
    
    /**
    * Calculates dimensions to be generated by a resize
    **/
    public function calcResizeDims (int $width, int $height, int $master) {
        // Method code goes here
    }
    
    /**
    * Generate a base64-encoded PNG image, e.g. for an &lt;img src=&quot;data:image/png;base64,...&quot;&gt; tag
    **/
    public function base64 (Path $file_path, ImageTransform $transform) {
        // Method code goes here
    }
    
    /**
    * Creates a new Image instance and returns it.
    **/
    public function factory (string $image, array $config) {
        // Method code goes here
    }
    
    /**
    * Creates a new image editor instance.
    **/
    public function __construct (string $image, array $config) {
        // Method code goes here
    }
    
    /**
    * Handles retrieval of pre-save image properties
    **/
    public function __get (string $property) {
        // Method code goes here
    }
    
    /**
    * Resize an image to a specific width and height. By default, Kohana will
    * maintain the aspect ratio using the width as the master dimension. If you
    * wish to use height as master dim, set $image-&gt;master_dim = Image::HEIGHT
    * This method is chainable.
    **/
    public function resize (integer $width, integer $height, integer $master) {
        // Method code goes here
    }
    
    /**
    * Save the image to a new image or overwrite this image.
    **/
    public function save (string $new_image, integer $chmod, boolean $keep_actions) {
        // Method code goes here
    }
    
    /**
    * Output the image to the browser.
    **/
    public function render (boolean $keep_actions) {
        // Method code goes here
    }
    
    /**
    * Sanitize a given value type.
    **/
    protected function validSize (string $type, mixed $value) {
        // Method code goes here
    }
    
    /**
    * Allows rotation of an image by 180 degrees clockwise or counter clockwise.
    **/
    public function rotate (integer $degrees) {
        // Method code goes here
    }
    
    /**
    * Flip an image horizontally or vertically.
    **/
    public function flip (integer $direction) {
        // Method code goes here
    }
    
    /**
    * Change the quality of an image.
    **/
    public function quality (integer $amount) {
        // Method code goes here
    }
    
    /**
    * Sharpen an image.
    **/
    public function sharpen (integer $amount) {
        // Method code goes here
    }
    
    /**
    * Crop an image to a specific width and height. You may also set the top
    * and left offset.
    * This method is chainable.
    **/
    public function crop (integer $width, integer $height, integer $top, integer $left) {
        // Method code goes here
    }
    
}
?>