• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
image_lib doesn't work nor produce any errors!?

#1
[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


Messages In This Thread
image_lib doesn't work nor produce any errors!? - by El Forum - 07-01-2008, 02:40 AM
image_lib doesn't work nor produce any errors!? - by El Forum - 07-08-2008, 02:29 AM
image_lib doesn't work nor produce any errors!? - by El Forum - 07-08-2008, 02:55 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.