Welcome Guest, Not a member yet? Register   Sign In
file resize problem

I made a function in a helper that copy and resize photos.
My problem is that since it copy and resize one image it does not do it with other images.
What maybe wrong?
function photocopy($file,$height,$width,$path)
    $config['image_library'] = 'gd2';
    // die($path.$name);
    $config['source_image'] = $file;
    // $config['create_thumb'] = TRUE;s
    $config['maintain_ratio'] = TRUE;
    $config['width'] =$width;// 100;
    $config['height'] =$height;// 100;
    $config['new_image'] = $path;
    $CI =& get_instance();
    $CI->load->library('image_lib', $config);
   // return $name;
I call this function as

my problem is that each time the page is loading only one is copied.
What may be wrong?

[eluser]GSV Sleeper Service[/eluser]
well, by the looks of it you're using $this->config->item('prview') as the 'path', which is then being used as the filename for the resized image. $this->config items are usually static, so you're effectively overwriting the previously resized image each time you call this function.

I put
but there is no change.
At debugging all seem ok.
The function is called 3 times at my example with the write arguments
(/path/example1.jpg next /path/example2.jpg for example) but only one from the 3 are created.

Theme © iAndrew 2016 - Forum software by © MyBB