Save file attributes for trailing CDR record.

@param File $file
@return void
761990
public function addToCdr(File $file): void
    {
        $file->ofs = $this->ofs;
        $this->ofs = $this->ofs->add($file->getTotalLength());
        $this->files[] = $file->getCdrFile();
    }
621089
protected function setThumbPaths($file)
    {
        $this->file      = $this->getOnlyFileName($file);
        $this->thumbPath = $this->createThumbDirectory($file);
    }
107296
private function AddFileToResult($directory, $file) {
        if (array_key_exists($directory, $this->FileList)) {
            array_push($this->FileList[$directory], $file);
            return;
        }
        //array_push($this->FileList, $directory);
        $this->FileList[$directory] = [$file];
    }
182733
public function save(string $file): bool
    {
        $stat = file_put_contents($file, $this->definition->toFbp());

        if ($stat === false) {
            return false;
        }

        return true;
    }
904912
public function saveFile(FileInterface $file)
    {
        $this->em->persist($file);
        $this->em->flush();

        $this->storage->saveFile($file);
    }
939969
public function write($file = '') {
        if ($file == '') {
            $file = $this->outSourceFile;
        }

        file_put_contents($file, $this->generate());
    }
344606
protected function savePicture($file)
    {
        $this->loadImageResource();

        // SUPPORT FOR CMYK IMAGES
        $colorSpace = new Colorspace();
        $colorSpace->apply($this);

        // APPLY EFFECT ON IMAGE
        foreach($this->effect as $effect)
        {
            if($effect instanceof PictureEffect)
            {
                $effect->apply($this);
            }
        }

        // CREATE DIRECTORY BY FILE PATH
        if(!file_exists($directory = dirname($file)))
        {
            mkdir($directory, 0777, TRUE);
        }

        $extension = strtolower(pathinfo($file, PATHINFO_EXTENSION));

        if($this->isGd())
        {
            if($extension === 'png')
            {
                if($this->progressive)
                {
                    imageinterlace($this->resource, TRUE);
                }

                imagepng($this->resource, $file, 9);
            }
            elseif($extension === 'gif')
            {
                $gifResource = $this->resource;

                if($this->isGdImageTransparent($gifResource))
                {
                    $validAlpha = ceil(0.333 * 127);
                    $visiblePixels = 0;

                    $height = imagesy($gifResource);
                    $width  = imagesx($gifResource);

                    $transparentColor = imagecolorallocate($gifResource, 0xfe, 0x3, 0xf4);

                    // FIX GIF IMAGE OPACITY
                    for($x = 0; $x < $width; $x++)
                    {
                        for($y = 0; $y < $height; $y++)
                        {
                            $pixelIndex = imagecolorat($gifResource, $x, $y);
                            $pixelColor = imagecolorsforindex($gifResource, $pixelIndex);

                            if($pixelColor['alpha'] <= $validAlpha)
                            {
                                $visiblePixels++;
                            }
                        }
                    }

                    if(!$visiblePixels)
                    {
                        $validAlpha = 127;
                    }

                    for($x = 0; $x < $width; $x++)
                    {
                        for($y = 0; $y < $height; $y++)
                        {
                            $pixelIndex = imagecolorat($gifResource, $x, $y);
                            $pixelColor = imagecolorsforindex($gifResource, $pixelIndex);

                            if($pixelColor['alpha'] >= $validAlpha)
                            {
                                imagesetpixel($gifResource, $x, $y, $transparentColor);
                            }
                            else
                            {
                                $visiblePixel = imagecolorallocatealpha(

                                    $gifResource,
                                    $pixelColor['red'],
                                    $pixelColor['green'],
                                    $pixelColor['blue'],
                                    0
                                );

                                imagesetpixel($gifResource, $x, $y, $visiblePixel);
                            }
                        }
                    }

                    imagecolortransparent($gifResource, $transparentColor);
                }

                if($this->progressive)
                {
                    imageinterlace($gifResource, TRUE);
                }

                imagegif($gifResource, $file);
            }
            else
            {
                $image = $this->resource;

                $width  = imagesx($image);
                $height = imagesy($image);

                $background = imagecreatetruecolor($width, $height);
                $whiteColor = imagecolorallocate($background,  255, 255, 255);

                imagefilledrectangle($background, 0, 0, $width, $height, $whiteColor);
                imagecopy($background, $image, 0, 0, 0, 0, $width, $height);

                if($this->progressive)
                {
                    imageinterlace($background, TRUE);
                }

                imagejpeg($background, $file, $this->quality);
            }
        }
        else
        {
            if($extension === 'jpg')
            {
                $background = $this->createImagick();
                $background->newImage(

                    $this->resource->getImageWidth(),
                    $this->resource->getImageHeight(),
                    '#FFFFFF'
                );

                $background->compositeImage($this->resource, Imagick::COMPOSITE_OVER, 0, 0);
                $background->setImageFormat('jpg');
                $background->setImageCompression(Imagick::COMPRESSION_JPEG);
                $background->setImageCompressionQuality($this->quality);

                if($this->progressive)
                {
                    $background->setInterlaceScheme(Imagick::INTERLACE_PLANE);
                }

                $background->writeImage($file);
            }
            elseif($extension === 'gif')
            {
                $validAlpha = 0.333;
                $visiblePixels = 0;
                $iterator = $this->resource->getPixelIterator();

                /** @var $pixel \ImagickPixel */
                foreach($iterator as $row => $pixels)
                {
                    foreach ($pixels as $col => $pixel)
                    {
                        $color = $pixel->getColor(TRUE);

                        if($color['a'] >= $validAlpha)
                        {
                            $visiblePixels++;
                        }
                    }

                    $iterator->syncIterator();
                }

                if(!$visiblePixels)
                {
                    $validAlpha = 0;
                }

                // SAVE NEW ALPHA COLOR VALUE
                foreach($iterator as $row => $pixels)
                {
                    foreach ($pixels as $col => $pixel)
                    {
                        $color = $pixel->getColor(TRUE);
                        $pixel->setColorValue(Imagick::COLOR_ALPHA, $color['a'] >= $validAlpha ? 1 : 0);
                    }

                    $iterator->syncIterator();
                }

                if($this->progressive)
                {
                    $this->resource->setInterlaceScheme(Imagick::INTERLACE_PLANE);
                }

                $this->resource->writeImage($file);
            }
            else
            {
                if($this->progressive)
                {
                    $this->resource->setInterlaceScheme(Imagick::INTERLACE_PLANE);
                }

                $this->resource->writeImage($file);
            }
        }

        chmod($file, 0777);
        touch($file, filemtime($this->getImage()));

        // DELETE TEMP FILES
        foreach($this->tmpImage as $tmpImage)
        {
            unlink($tmpImage);
        }
    }
1260824
protected function saveCredentialJson(string $file, $data)
    {
        $content = json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PARTIAL_OUTPUT_ON_ERROR | JSON_PRETTY_PRINT);
        $this->filesystem->dumpFile($file, $content);
    }
780195
public function delete($file)
	{
		$metaFile = $this->getMetaFilePath($file);
		if ($this->fs->exists($metaFile))
			$this->fs->delete($metaFile);
		if ($this->f3->get('CACHE')) {
			$cache = \Cache::instance();
			if ($cache->exists($cacheHash = $this->getCacheHash($file)))
				$cache->clear($cacheHash);
		}
	}
280039
protected function addResourceFile(string $file): void
    {
        if (!is_file($file)) {
            throw new \InvalidArgumentException("$file is not a file");
        }
        
        $contents = file_get_contents($file);
        
        if ($contents === false) {
            throw new \RuntimeException("Error reading file at $file.");
        }
        
        $this->addResourceString($contents);
    }
1100985
public function addFile($file)
    {
        $this->box->addFile($file, $this->pharComposer->getPathLocalToBase($file));
    }
427758
public function save($file, $compiled)
    {
        $this->temporaryFileManager->enterModule('Templating');

        $this->temporaryFileManager->save($file . '.php', $compiled);
        $this->temporaryFileManager->exitModule();
    }
97897
protected function addUploadedFile($file)
    {
        $this->clear();

        $this->uploaded_file = $this->getFileManager()->make($file);

        // Get the original values
        $filename = $this->uploaded_file->getClientOriginalName();
        $content_type = $this->uploaded_file->getMimeType();

        // Set model values
        $this->instanceWrite('file_name', $filename);
        $this->instanceWrite('file_size', $this->uploaded_file->getSize());
        $this->instanceWrite('content_type', $content_type);
        $this->instanceWrite('updated_at', date('Y-m-d H:i:s'));
        $this->instanceWrite('queued_file', null);

        // Queue all styles for writing
        $this->setQueue('write', $this->styles);
    }
705120
public function setSrcfile($file)
    {
        if (is_string($file)) {
            $file = new PhingFile($file);
        }
        $this->_sourceFile = $file;
    }
724868
public function writeFile($file, $content)
    {
        $this->ensureDir(dirname($file));

        file_put_contents($file, $content);
    }
999880
public function storeFile($file)
    {
        $filename = md5($this->id);
        $data = file_get_contents($file->tmp_name);

        if ($this->getFileName() == $this->name) {
            $this->name = $file->name;
        }

        $file->append(array(
            'type' => mime_content_type($file->name),
        ));

        $this->mimeType = $file->type;
        $this->setValue('file_name', $file->name);
        $this->fileSize = strlen($data);
        $this->writeData($filename, $data, false);
    }
354466
public function load($file)
	{
		$details = pathinfo($file);
		$this->filename = $details['basename'];
		$this->extension = $details['extension'];
		$this->directory = $details['dirname'];
	}