CodeIgniter Forums
image_lib doesn't work nor produce any errors!? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: image_lib doesn't work nor produce any errors!? (/showthread.php?tid=9595)



image_lib doesn't work nor produce any errors!? - El Forum - 07-01-2008

[eluser]KeyStroke[/eluser]
Hi,

I'm trying to resize an image after an upload, but the script seems to terminate and return nothing on '$this->image_lib->resize()'.

Here's the code:
Code:
// upload file
if(!$this->upload->do_upload('image')) // if upload fails, process errors
        {
            $file_upload_errors = array('error' => $this->upload->display_errors());
            
            return $file_upload_errors;
        }
        else
        {
            // if it succeeds, get the upload data
            $file = array('upload_data' => $this->upload->data());
    
            // if file exceeds size restrictions
            if($file['upload_data']['image_width'] > 500 || $file['upload_data']['image_height'] > 500)
            {
                // configure image library
                $settings['source_image'] = './uploads/' . $file['upload_data']['file_name'];;
                $settings['maintain_ratio'] = TRUE;
                $settings['width'] = 500
                $settings['height'] = 500

                // load and initialize image library
                $this->load->library('image_lib', $settings);
                $this->image_lib->initialize($settings);
        
                // resize image
                if ( !$this->image_lib->resize())
                {
                     // if resize fails, return errors
                     $file_upload_error = $this->image_lib->display_errors();
                     return $file_upload_error;
                }
            }
            
            
            // return uploaded file data
            return $file;
        }

Do you have any idea why this won't work? the code works just fine without the resize bit.


Your help is much appreciated


image_lib doesn't work nor produce any errors!? - El Forum - 07-08-2008

[eluser]metaltapimenye[/eluser]
i got the same problem... Sad


image_lib doesn't work nor produce any errors!? - El Forum - 07-08-2008

[eluser]metaltapimenye[/eluser]
i got it..
check your $setting['source_image']. the system dont find the image, but wont declare any warnings.. ( about '@' stuff)
as an illustration to describe it, put my code on yours just right after it initiates.


Code:
print_r($this->image_lib);

n_n