Convert GIF to jpg? Possible?

I want to accomplish this in CodeIgniter specifically.

The PHP application that I am coding allows the user to upload either a jpg or an animated gif. In the next step, I want to allow the user to use jCrop to crop thumbnails of different sizes. This will require me to convert a new copy of the animated gif to jpg. My code works fine with uploaded jpg images, but it creates a broken image for gif files. Am I trying to do this?

My code is:

                // Create image to crop
            $config['image_library'] = 'ImageMagick';
            $config['library_path'] = '/usr/bin';
            $config['source_image'] = $this->config->item('upload_dir_path') . $file_path . 'original.' . $file_ext;
            chmod($config['source_image'], 0777);
            $config['new_image'] = $this->config->item('upload_dir_path') . $file_path . 'crop-me.jpg';
            $this->image_lib->initialize($config); 
            $this->image_lib->resize();
+3
source share
1 answer

, , GD PHP. gif, , . , CodeIgniter Image_lib ( , ) .

:

$image = imagecreatefromgif($path_to_gif_image);
imagejpeg($image, $output_path_with_jpg_extension);

, .

+8

All Articles