Skip to content

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

Description

@SilasOlatayo

@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();
    }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions