Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to unlink() the source file after extraction #9

Open
SilasOlatayo opened this issue Aug 23, 2015 · 0 comments
Open

Unable to unlink() the source file after extraction #9

SilasOlatayo opened this issue Aug 23, 2015 · 0 comments

Comments

@SilasOlatayo
Copy link

@Sybio
I was unable to delete the source file after extraction. I was getting permission error and that only occur when i use $gifExtract->extract($rawSource);

So i found out it was a permission issue. So i tried

@chmod($rawSource, 465);
@unlink($rawSource);

But what if the code is running on a shared host with chmod restriction.
So I look into the GifFrameExtractor.php file and I found out the file wasn't closed after processing.

So I made a slit tweak by adding $this->closeFile(); and it fix the problem.

private function parseFramesInfo($filename)
    {
        $this->openFile($filename);
        $this->parseGifHeader();
        $this->parseGraphicsExtension(0);
        $this->getApplicationData();
        $this->getApplicationData();
        $this->getFrameString(0);
        $this->parseGraphicsExtension(1);
        $this->getCommentData();
        $this->getApplicationData();
        $this->getFrameString(1);
        
        while (!$this->checkByte(0x3b) && !$this->checkEOF()) {
            
            $this->getCommentData(1);
            $this->parseGraphicsExtension(2);
            $this->getFrameString(2);
            $this->getApplicationData();
        }
        $this->closeFile();
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant