[eluser]boudewijn[/eluser]
Hi all,
first off: I'm pretty new to CI so I hope im posting this in the right place and in the right way. Anyway, i'm having a strange problem concerning a resize library i wrote.
this is the code
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Resize {
function resize_book_large($data)
{
$file_name = element('file_name', $data['upload_data']);
$path = 'uploads/'.$file_name;
$CI =& get_instance();
$config['image_library'] = 'gd2';
$config['source_image'] = $path;
$config['new_image'] = 'uploads/thumbs/large_'.$file_name;
$config['create_thumb'] = TRUE;
$config['maintain_ratio'] = TRUE;
$config['width'] = 300;
$config['height'] = 450;
$CI->load->library('image_lib', $config);
echo $CI->image_lib->resize();
if ( ! $CI->image_lib->resize())
{
echo $CI->image_lib->display_errors();
}
}
function resize_book_small($data)
{
$file_name = element('file_name', $data['upload_data']);
$path = 'uploads/'.$file_name;
$CI =& get_instance();
$config['image_library'] = 'gd2';
$config['source_image'] = $path;
$config['new_image'] = 'uploads/thumbs/small_'.$file_name;
$config['create_thumb'] = TRUE;
$config['maintain_ratio'] = TRUE;
$config['width'] = 150;
$config['height'] = 175;
$CI->load->library('image_lib', $config);
echo $CI->image_lib->resize();
if ( ! $CI->image_lib->resize())
{
echo $CI->image_lib->display_errors();
}
}
}
?>
now i loaded $this->load->library('Resize'); in my controller, so far so good
the problem is however that
when i try to call upon
$this->resize->resize_book_small($data);
$this->resize->resize_book_large($data);
only the first one works (in this case _small, but if i shift large up, _large works).
By works i mean giving me the thumbnail in the directory i specified.
To make it even stranger:
Code:
echo $CI->image_lib->resize();
gives me TRUE for both functions
so it seems that they both work, but only the first one is giving me an output file...
I tried alot of things but im hopeless atm.
Hope someone can help and that this is clear enough!
cheers