/** * Loads the image and checks if its compatable. * * @param string $filename The file to load * @return Image_Driver */ public static function load($filename) /** * Crops the image using coordinates or percentages. * * Absolute integer or percentages accepted for all 4. * * @param integer $x1 X-Coordinate based from the top-left corner. * @param integer $y1 Y-Coordinate based from the top-left corner. * @param integer $x2 X-Coordinate based from the bottom-right corner. * @param integer $y2 Y-Coordinate based from the bottom-right corner. * @return Image_Driver */ public static function crop($x1, $y1, $x2, $y2) /** * Resizes the image. If the width or height is null, it will resize retaining the original aspect ratio. * * @param integer $width The new width of the image. * @param integer $height The new height of the image. * @param boolean $keepar Defaults to true. If false, allows resizing without keeping AR. * @return Image_Driver */ public static function resize($width, $height, $keepar = true) /** * Rotates the image * * @param integer $degrees The degrees to rotate, negatives integers allowed. * @return Image_Driver */ public static function rotate($degrees) /** * Adds a watermark to the image. * * @param string $filename The filename of the watermark file to use. * @param string $position The position of the watermark, ex: "bottom right", "center center", "top left" * @param * @return Image_Driver */ public static function watermark($filename, $position, $padding = 5) /** * Adds a border to the image. * * @param integer $size The side of the border, in pixels. * @param string $color A hexidecimal color. * @param Image_Driver */ public static function border($size, $color = null) { /** * Masks the image using the alpha channel of the image input. * * @param string $maskimage The location of the image to use as the mask * @return Image_Driver */ public static function mask($maskimage) { /** * Adds rounded corners to the image. * * @param integer $radius * @param integer $sides Accepts any combination of "tl tr bl br" seperated by spaces, or null for all sides * @param integer $antialias Sets the antialias range. * @return Image_Driver */ public static function rounded($radius, $sides = null, $antialias = null) /** * Saves the image, and optionally attempts to set permissions * * @param string $filename The location where to save the image. * @param string $permissions Allows unix style permissions */ public static function save($filename, $permissions = null) /** * Outputs the file directly to the user. * * @param string $filetype The extension type to use. Ex: png, jpg, bmp, gif */ public static function output($filetype)
/** * These presets allow you to call controlled manipulations. */ 'presets' => array( /** * This shows an example of how to add preset manipulations * to an image. * * Note that config values here override the current configuration. * * Drivers cannot be changed in here. */ 'example' => array( 'quality' => 100, 'bgcolor' => '#FFFFFF', 'imagetype' => 'png', 'actions' => array( array('crop', '10%'), array('resize', 150, 150, true), array('rotate', -90), /** * Variables passed to the preset function (such as $this->preset('example', '/www/public/images/image.png) ) * can be used to set variables in the presets. In this function, the $1 would be replaced by * '/www/public/images/image.png' */ array('save', '$1') ) ) )
Image::load('/path/to/file.ext') Image::preset('example', '/path/to/newfile.ext);
Kris K wrote on Saturday 4th of June 2011:I'll leave a message here when I send it, then you can just take it from the repo or wait until its merged (They are usually quick with that)
You'll have to create a config file in your app/config folder for image.php and change the Imagemagick executable location from that WAMP location to wherever you have it installed. I can't comprehend why the C:/ WAMP directory is the core defined configuration setting for Fuel, but it is. I would try to figure out how to access Imagemagick executables before giving up in favor of GD. Imagemagick is faster. OH, and to answer your actual question. Prior to recently, all functions were being passed through to the GD driver, regardless of configuration. So an error like this one wouldn't have shown, as GD was being used. If GD suits you well, all you have to do is follow the directions on this page: http://fuelphp.com/docs/classes/image.html#configurationA Huzz wrote on Sunday 3rd of July 2011:hi guys! I'm getting this error message below after download the latest from the develop repository. It was working fine before. Fuel\Core\Fuel_Exception [ Error ]: imagemagick executables not found in C:/wamp/imagemagick/ Any idea why?
'actions' => array( // if we not change quality, keep the one prom config (current 100) array('resize_crop', 150, 150), array('save_pa', 'prepend_text_', '_thumb_150x150_100') // here it would create the new file. 100 in the append is the quality value (it's usefull when you wanna check if specific files exists, if no, regenerate the thumbnail from original) array('quality', 90), // we change the quality for further processing array('resize_crop', 500, 500), // working with original file array('save_pa', '', '_thumb_500x500_90') // ofc prepend and append text would be hardcoded or passed to the config somehow ? array('resize_crop', 500, 500), // here we would still work with the original file array('save', '$1') // here it would overwrite the original file )
Image::load_config('another_image');
$root_path = './assets/uploads/'; foreach (\Config::get('thumbs') as $preset => $path) { if ( ! file_exists($root_path.$path) ) { \File::create_dir($root_path, $path); } \Image::load($root_path.$saved_as)->preset($preset)->save($root_path.$path.'/'.$saved_as); }
'thumb_100' => array( 'actions' => array( array('crop_resize', 100, 100), ) ), 'thumb_200' => array( 'actions' => array( array('resize', 200), ) ),
It looks like you're new here. If you want to get involved, click one of these buttons!