Welcome Guest, Not a member yet? Register   Sign In
Images resize check works offline but not online.
#1

[eluser]murphy2006[/eluser]
Hello,

I am struggeling with an upload/resize function where a user can upload an image and then it will be resized to correctly display on the website.

All works fine if an image i Larger than the config width but if the user uploads an image which is smaller CI automatically Enhances the size which makes the small image look very bad. I tried the below code to check size and act and it works fine offline (localhost) but does not create the image when online using exactly the same code!

Is there a smarter (more correct) way of checking size?

Code:
$config['image_library']     = 'GD2';
        $config['source_image']     = $imgfile;
        $config['create_thumb']     = FALSE;
        $config['maintain_ratio']     = TRUE;
        $config['quality']             = '95%';


        if ($data['upload_data']['image_width'] > 500) {
        
        $config['width']             = 500;
        
        } else {
        
        $config['width']             = $data['upload_data']['image_width'];
        
        }

        if ($data['upload_data']['image_height'] > 300) {
        
        $config['height']             = 300;
        
        } else {
        
        $config['height']             = $data['upload_data']['image_height'];
        
        }

Please help, I spent hours on this.

Kind Regards,
Daniel
#2

[eluser]thurting[/eluser]
Are you sure you have GD2 installed on your remote environment?
#3

[eluser]murphy2006[/eluser]
Yes, I guess so since it creates the image fine if the uploaded image is bigger than the config width.




Theme © iAndrew 2016 - Forum software by © MyBB