Home >Backend Development >PHP Tutorial >How to keep the gif dynamic when cropping a gif image using ci.
<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.
<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