Welcome Guest, Not a member yet? Register   Sign In
[SOLVED]Image resize - not working without thumb
#1

[eluser]karloff[/eluser]
I have been battling at getting the resize function working. At the moment, the resize does not work unless create_thumb is set to true... can anyone spot anything I'm doing wrong??

Code:
$config['image_library'] = 'gd2';
            $config['create_thumb'] = FALSE;
            $config['maintain_ratio'] = TRUE;
            $config['overwrite']    = TRUE;
            $config['quality'] = 100;
            $config['width'] = 478;
            
            $config['master_dim'] = 'width';
            
            $config['source_image'] = './images/projects/'.$_FILES['image']['name'];
            

            $this->load->library('image_lib', $config);
            $this->image_lib->initialize($config);
            if ( ! $this->image_lib->resize() )
            {
                $data['error'] = $this->image_lib->display_errors();
                $this->template->load('admin_template', '/backend/add_work', $data);
            }
#2

[eluser]slowgary[/eluser]
Could it be an issue with file permissions? Setting the 'create_thumb' option to true causes the resize to create another image. I bet setting the 'new_image' config item would also work. Where you're having a problem is with neither - when you want to overwrite the src_image. File permissions make sense.
#3

[eluser]Thorpe Obazee[/eluser]
Code:
'source_image'   => $source_image,
//'create_thumb'   => TRUE,
//'thumb_marker'   => '_thumb',
//'new_image'      => './uploads/thumbs/',
'maintain_ratio' => TRUE,
'width'          => 75,
'height'         => 50

I've been using this and I commented out 'create_thumb', 'thumb_marker' and 'new_image' and it targeted the original image. True to what the user_guide said.

Permissions doesn't seem to be the problem if you can overwrite the file anyway.

Btw, change the
Code:
$this->load->library('image_lib', $config);
to
Code:
$this->load->library('image_lib');
#4

[eluser]slowgary[/eluser]
Yeah but where in that code is he "overwriting the file anyway"?

Karloff are you getting any error messages?
#5

[eluser]Thorpe Obazee[/eluser]
[quote author="slowgary" date="1240992677"]Yeah but where in that code is he "overwriting the file anyway"?

Karloff are you getting any error messages?[/quote]

oh. my bad. Perhaps permissions then.
#6

[eluser]slowgary[/eluser]
Could also be the gnomes. Gnomes have eaten my code like 12 times already. Really annoying.
#7

[eluser]karloff[/eluser]
Gary, think you may be correct, sound like a permissions prob, obliviously i can create a file fine but overwriting the files cause probs

i'm on a mac, any suggestion on how to possible get around the permissions rob or debug?
#8

[eluser]karloff[/eluser]
i should also note if i chmod teh whole dir then resize it works, and no i'm not getting any errors

*hits head against wall
#9

[eluser]Thorpe Obazee[/eluser]
You should probably chmod it then when you resize files
#10

[eluser]karloff[/eluser]
sounds advice, seems to be an error with chmod

Message: chmod() [function.chmod]: No such file or directory

I'l look into that and get back to you




Theme © iAndrew 2016 - Forum software by © MyBB