Grafika\Gd\Editor::flatten PHP 메소드

flatten() 공개 메소드

Flatten if animated GIF. Do nothing otherwise.
public flatten ( Image &$image ) : Editor
$image Image
리턴 Editor
    public function flatten(&$image)
    {
        if ($image->isAnimated()) {
            $old = $image->getCore();
            $gift = new GifHelper();
            $hex = $gift->encode($image->getBlocks());
            $gd = imagecreatefromstring(pack('H*', $hex));
            // Recreate resource from blocks
            imagedestroy($old);
            // Free resource
            $image = new Image($gd, $image->getImageFile(), $image->getWidth(), $image->getHeight(), $image->getType(), '', false);
        }
        return $this;
    }