Welcome Guest, Not a member yet? Register   Sign In
Resizing image does not work
#1

Hi, I have spent a whole day trying to trace this issue.

The closest I got was this:
https://forum.codeigniter.com/thread-60211.html

I CAN upload images.
I checked phpinfo() and I do have GD installed and enabled.
I am using a relative path.
the upload folder has the correct permissions for www-data

But I get this error on running the resize command:


Quote:Your server does not support the GD function required to process this type of image.


BTW, I'm using Ubuntu 14.04

Can someone please help debug this?
Thanks!
Reply
#2

I fixed it through trial-and error. I'm posting this for the benefit of someone else.

My non-working code:

PHP Code:
        $config['image_library'] = 'gd2';
        $config['source_image'] = './uploads/' $pImage;
        $config['new_image'] = './uploads/000.png';
        $config['maintain_ratio'] = TRUE;
        $config['width']         $pWidth;
        $config['height']       $pHeight;

        $this->CI->load->library('image_lib');
        $this->CI->image_lib->initialize($config);
        $this->CI->image_lib->clear();

        if ( ! $this->CI->image_lib->resize()) {
              echo $this->CI->image_lib->display_errors();

        

To make it work, I just removed the line:
PHP Code:
$this->CI->image_lib->clear(); 

I found the use of the clear method in another forum but simply removing it worked.
Reply
#3

Your answer is in your quuote .. you have to install an image library like GD.

Reply
#4

(05-24-2017, 07:53 AM)Rufnex Wrote: Your answer is in your quuote .. you have to install an image library like GD.

That's my point. As I pointed out in my initial post, I already HAD GD installed.
Anyway, thanks for your inputs.
Cheers!
Teacher of Computer Science and Consultant
Reply




Theme © iAndrew 2016 - Forum software by © MyBB