Welcome Guest, Not a member yet? Register   Sign In
Added to Wiki: image resizing and squaring library
#1

[eluser]JoostV[/eluser]
Image resizing and cropping can take up a lot of repetitive code. I added an image library to the Wiki that I use to create thumbs and resized versions of images (square or not).

EDIT: This library has been moved to Github
https://github.com/accent-interactive/ci-lib-images


By default, images are squared from the center, but this can be offset, too.

Example usage:
Code:
function image ()
{
    $original = 'test_image.jpg';
    $new = 'test_image_altered.jpg';
    $originalPath = '/full/path/to/original/image/folder/';
    $newPath = '/full/path/to/altered/image/folder/';
    $maxSize = 150;
    $this->load->library('images');
    
    // Create square and resized image example
    $this->images->squareThumb($originalPath . $original, $newPath . $new, $maxSize);
    
    // Create resized image example
    $this->images->resize($originalPath . $original, $maxSize, $maxSize, $newPath . $new);
    
    // Create square image image
    $this->images->square($originalPath . $original, $newPath . $new);
}


Messages In This Thread
Added to Wiki: image resizing and squaring library - by El Forum - 12-07-2009, 05:29 AM
Added to Wiki: image resizing and squaring library - by El Forum - 02-03-2010, 03:16 PM
Added to Wiki: image resizing and squaring library - by El Forum - 02-04-2010, 05:12 AM
Added to Wiki: image resizing and squaring library - by El Forum - 02-04-2010, 07:29 AM
Added to Wiki: image resizing and squaring library - by El Forum - 06-07-2010, 03:02 AM
Added to Wiki: image resizing and squaring library - by El Forum - 06-07-2010, 03:46 AM
Added to Wiki: image resizing and squaring library - by El Forum - 06-07-2010, 05:08 AM
Added to Wiki: image resizing and squaring library - by El Forum - 06-08-2010, 02:22 AM
Added to Wiki: image resizing and squaring library - by El Forum - 06-08-2010, 09:37 AM
Added to Wiki: image resizing and squaring library - by El Forum - 06-08-2010, 10:06 AM
Added to Wiki: image resizing and squaring library - by El Forum - 04-21-2011, 05:55 AM
Added to Wiki: image resizing and squaring library - by El Forum - 04-27-2011, 05:04 AM
Added to Wiki: image resizing and squaring library - by El Forum - 04-27-2011, 05:11 AM
Added to Wiki: image resizing and squaring library - by El Forum - 04-27-2011, 05:40 AM
Added to Wiki: image resizing and squaring library - by El Forum - 04-27-2011, 06:29 AM
Added to Wiki: image resizing and squaring library - by El Forum - 04-28-2011, 06:36 AM
Added to Wiki: image resizing and squaring library - by El Forum - 06-24-2011, 01:14 AM
Added to Wiki: image resizing and squaring library - by El Forum - 06-24-2011, 01:27 AM
Added to Wiki: image resizing and squaring library - by El Forum - 07-18-2011, 11:32 AM
Added to Wiki: image resizing and squaring library - by El Forum - 05-06-2012, 01:14 PM



Theme © iAndrew 2016 - Forum software by © MyBB