CodeIgniter Forums
Image Library not creating image - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Image Library not creating image (/thread-35109.html)



Image Library not creating image - El Forum - 10-19-2010

[eluser]Unknown[/eluser]
Hello friends,

I've been trying to make a helper that processes an image filename passed as an argument, and returns a relative path to the newly-created (and resized) image. The helper doesn't error, and returns the correct value, but the actual resized image never gets created. Is there something glaringly wrong about this code?

Thank you for your input.

Code:
function resized_image($graphic_filename, $type)
{
    $CI =& get_instance();
    
    $CI->load->library('image_lib');
    
    $image_path = "/home/lfc1450/webapps/lfcfrontend/images/message_images/";
    $cached_path = "/home/lfc1450/webapps/lfcfrontend/images/cached/";
    $url_path = "/images/cached/";

    $config['image_library'] = 'imagemagick';
    $config['library_path'] = '~/bin';
    $config['maintain_ratio'] = TRUE;
    $config['quality'] = '90%';

    if ($type == "billboard")
    {
        $config['source_image'] = $image_path.$graphic_filename;
        $config['new_image'] = $cached_path.'billboard/'.$graphic_filename;
        $config['width'] = 940;
        $CI->image_lib->initialize($config);
        
        if ( ! $CI->image_lib->resize())
        {
            echo $CI->image_lib->display_errors();
        }

        return $url_path.'billboard/'.$graphic_filename;
    }
}



Image Library not creating image - El Forum - 10-20-2010

[eluser]umefarooq[/eluser]
hi try my helper from this post

http://ellislab.com/forums/viewthread/157314/