1

GIF を分割したいのですが、最初のフレームが必要です。今は、ImageMagick に php API を使用しています。次のコードを書きますが、コードは全体像を返します。

function imagemagick_auto_img($inputImg,$dstWidth,$dstHeight) {
          try {

                    $im = new Imagick($inputImg);
                    $im = $im->coalesceImages();
                    $outputData = array('width'=> $dstWidth, 'height' => $dstHeight);

                    foreach ($im as $frame) {
                      $frame->thumbnailImage($outputData['width'],$outputData['height']);
                      $frame->writeImages($createImg, true);
                      return $createImg;
                    }
            } catch(Exception $e) {
                    $createImg = $this->autoImgThumbs($inputImg,$dstWidth, $dstHeight);
            }

}
4

0 に答える 0