Welcome Guest, Not a member yet? Register   Sign In
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
#2

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

[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




Theme © iAndrew 2016 - Forum software by © MyBB