Skip to content
This repository has been archived by the owner on Jan 24, 2021. It is now read-only.

how to get frame count? #11

Open
khstar2000 opened this issue Jan 31, 2018 · 1 comment
Open

how to get frame count? #11

khstar2000 opened this issue Jan 31, 2018 · 1 comment

Comments

@khstar2000
Copy link

khstar2000 commented Jan 31, 2018

i nedd frame count in render and decorder.
see in following code
$gifStream = new FileStream($target_file);
$gifDecoder = new Decoder($gifStream);
$gifRenderer = new Renderer($gifDecoder);
$gifRenderer->start(function (FrameRenderedEvent $event) {
imagepng($event->renderedFrame, DIR . "/../gif_render/frame{$event->frameIndex}.png");
});
and how to change png filepath and filename(here is gif_render/frame ....png).
then create png, how know png count?

@ghost
Copy link

ghost commented Sep 15, 2019

Upd:
This is the best solution, which i have found:

<?php
function FrameCount($File){

if(is_file($File)) $File = file_get_contents($File);
return abs(substr_count($File, "\x21\xf9")-substr_count($File,"\x21\xfe")-2);

}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant