Welcome Guest, Not a member yet? Register   Sign In
Image library: resizing two or more images
#6

[eluser]demogar[/eluser]
I would use a function for it so I can reuse code and it would be just simplier to modify.

Code:
function something(){
    # Generate the thumbnail / resize the image
    $this->_createThumb('file', 250, 300, '/images/', MARKER);
}

function _createThumb($file, $width, $height, $path, $marker = NULL) {
    # Lib config
    $config['image_library']    = 'gd2';
    $config['source_image']        = $path . $file;
    $config['new_image']        = $path . 'thumbs/' . $file;
    $config['thumb_marker']        = $marker;
    $config['create_thumb']        = TRUE;
    $config['maintain_ratio']    = TRUE;
    $config['width']         = $width;
    $config['height']         = $height;
    
    # Load the library
    $this->load->library('image_lib', $config);
    
    # Resize the image and clear the lib
    $this->image_lib->resize();
    $this->image_lib->clear();
}

Cheers


Messages In This Thread
Image library: resizing two or more images - by El Forum - 11-27-2009, 10:14 PM
Image library: resizing two or more images - by El Forum - 11-28-2009, 11:34 AM
Image library: resizing two or more images - by El Forum - 11-28-2009, 01:00 PM
Image library: resizing two or more images - by El Forum - 11-28-2009, 02:42 PM
Image library: resizing two or more images - by El Forum - 11-28-2009, 02:55 PM
Image library: resizing two or more images - by El Forum - 11-28-2009, 03:01 PM
Image library: resizing two or more images - by El Forum - 11-28-2009, 03:35 PM
Image library: resizing two or more images - by El Forum - 04-09-2010, 09:44 AM
Image library: resizing two or more images - by El Forum - 04-09-2010, 09:59 AM



Theme © iAndrew 2016 - Forum software by © MyBB