Home >Backend Development >PHP Tutorial >How to keep the gif dynamic when cropping a gif image using ci.

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

WBOY
WBOYOriginal
2016-09-25 09:37:021600browse

<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>

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>

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>

Doesn’t support processing gifs while maintaining dynamic effects

Statement:
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