How to keep the gif dynamic when cropping a gif image using ci.

WBOY
Release: 2016-09-25 09:37:02
Original
1541 people have browsed it

<code>    $config['image_library'] = 'gd2';
    $config['source_image'] = 'upload/ali.gif';
    $config['create_thumb'] = TRUE;
    $config['maintain_ratio'] = TRUE;
    $config['width'] = 75;
    $config['height'] = 50;

    $this->load->library('image_lib', $config);

    $this->image_lib->resize();
    
    </code>
Copy after login
Copy after login

The original image is a dynamic gif image. After processing by the above program, the generated image is static. How can I stay dynamic, thank you.

Reply content:

<code>    $config['image_library'] = 'gd2';
    $config['source_image'] = 'upload/ali.gif';
    $config['create_thumb'] = TRUE;
    $config['maintain_ratio'] = TRUE;
    $config['width'] = 75;
    $config['height'] = 50;

    $this->load->library('image_lib', $config);

    $this->image_lib->resize();
    
    </code>
Copy after login
Copy after login

The original image is a dynamic gif image. After processing by the above program, the generated image is static. How can I stay dynamic, thank you.

Currently, the two major libraries for php processing images gd2 and imagick do not support cutting gif images (they will not be moved after processing), so the questioner should not forget to deal with this aspect,

Intervention/image

I specially tried this library

<code class="php">require './vendor/autoload.php';

use Intervention\Image\ImageManager;

$image = new ImageManager(array('driver' => 'imagick'));


$image = $image->make('/home/godruoyi/图片/5gyt521cv3v.gif');
$image->resize(500,300);

$image->save('/home/godruoyi/图片/5gyt521cv3v2222.gif');</code>
Copy after login

Doesn’t support processing gifs while maintaining dynamic effects

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!