Welcome Guest, Not a member yet? Register   Sign In
Help understanding image_lib - resizing?!
#1

[eluser]gRoberts[/eluser]
Hi all,

Sorry to ask such a stupid question but I am having some major problems trying to understand the resize function of the image library.

Basically, the user uploads a single image, and I want to create a thumbnail (100x100) and I want to create a medium image (250x250).

The code below creates the 100x100 image but the image is TINY (2x2) inside a black square (100x100) and the 250x250 image remains the original size (its over 250x250).

Code:
function generateThumbnail($source, $output, $width, $height, $watermark = true) {
        $base =& get_instance();
        $dir = dirname($output);
        if(!is_dir($dir))
            recursive_mkdir($dir);
            
        copy($source, $output);
            
        $config['library_path'] = '';
        $config['source_image'] = $output;
        $config['maintain_ratio'] = TRUE;
        $config['quality'] = 100;
        $config['width'] = (int)$width;
        $config['height'] = (int)$height;
            
        $base->load->library('image_lib', $config);
        if(!$base->image_lib->resize())
            die($base->image_lib->display_errors());
        
        if($watermark)
            applyWatermarkToImage($output);    
        
    }

Without copying the file first, it doesn't do anything.

Any advice would be gratefully appreciated!

Cheers


Messages In This Thread
Help understanding image_lib - resizing?! - by El Forum - 12-10-2007, 02:44 PM
Help understanding image_lib - resizing?! - by El Forum - 12-10-2007, 03:10 PM
Help understanding image_lib - resizing?! - by El Forum - 12-11-2007, 01:37 AM
Help understanding image_lib - resizing?! - by El Forum - 12-11-2007, 11:45 AM
Help understanding image_lib - resizing?! - by El Forum - 12-11-2007, 11:57 AM
Help understanding image_lib - resizing?! - by El Forum - 12-11-2007, 12:12 PM
Help understanding image_lib - resizing?! - by El Forum - 12-11-2007, 03:14 PM
Help understanding image_lib - resizing?! - by El Forum - 12-11-2007, 03:17 PM
Help understanding image_lib - resizing?! - by El Forum - 12-11-2007, 03:26 PM



Theme © iAndrew 2016 - Forum software by © MyBB