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

[eluser]dimis[/eluser]
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?
Code:
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);
    $CI->image_lib->resize();
   // return $name;
}
I call this function as
Code:
photocopy($this->config->item('pr').$this->data['product'][0]['color_photo'],
61,128,$this->config->item('prview'));
#2

[eluser]dimis[/eluser]
my problem is that each time the page is loading only one is copied.
What may be wrong?
#3

[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.
#4

[eluser]dimis[/eluser]
I put
Code:
photocopy($this->config->item('pr').$this->data['product'][0]['color_photo'],
61,128,$this->config->item('prview').$list['code_photo']);
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