Welcome Guest, Not a member yet? Register   Sign In
resizing and creating thumbnail problem
#1

[eluser]mycr0ft[/eluser]
Hello,
I need a help with my page. I want to resize & create thumbnail of 4 uploaded images.
the problem is: the image can only resized at wrong size. I try to resize it to 400x400 (not absoulte size). but it resized to 100x100 which are the size of the thumbnail. and there is no thumbnail created.

please someone help me...

here are my codes to resize & create thumbnail:
Quote:for ($i=1;$i<5;$i++)
if ($_FILES['userfile'.$i]['name']<>''){
if ( ! $this->upload->do_upload('userfile'.$i)){
$data['errorMsg']=$this->upload->display_errors();
$this->load->view('input_product', $data);
}
else{
$foto = array('upload_data' => $this->upload->data());
$config2['source_image'] = $foto['upload_data']['full_path'];
$config2['create_thumb'] = FALSE;
$config2['width'] = 400;
$config2['height'] = 400;
$this->image_lib->initialize($config2);
if ( ! $this->image_lib->resize()){echo $this->image_lib->display_errors();}
$this->image_lib->clear();
$config2['width'] = 100;
$config2['height'] = 100;
$config2['create_thumb'] = TRUE;
$this->image_lib->initialize($config2);
if ( ! $this->image_lib->resize()){echo $this->image_lib->display_errors();}
$this->image_lib->clear();
}
#2

[eluser]mycr0ft[/eluser]
hello,nobody can help me?
or no one face the same problem?

please,if anyone can did it correctly please let me know...
#3

[eluser]Colin Williams[/eluser]
Maybe your second resize is overriding the first?
#4

[eluser]mycr0ft[/eluser]
so how to fix it?
cant I use the same image source?
#5

[eluser]rogierb[/eluser]
did you set a new name for the thumb? (new_image).
If not, it might get overwritten.
#6

[eluser]sideshowbob[/eluser]
I encountered the same issue, perhaps it's a bug?

I resolved it by adding the thumb_marker preference to the config array for the 2nd resize.

e.g.
Code:
$config2['thumb_marker'] = '_thumb';

Hope that helps.
#7

[eluser]jrtashjian[/eluser]
When you used $this->image_lib->clear() after the first resize, you also reset the source image. You didn't have a source image set for the second one, therefore it failed. Set the source image for each resize after clear and try it again.




Theme © iAndrew 2016 - Forum software by © MyBB