Saves a image to the HD format.

@param string $path
@param string $dest
@param string $type
972133
private function _saveHd ($path, $name, $file)
		{
			$this->_save($path . DIRECTORY_SEPARATOR . self::F_HD . DIRECTORY_SEPARATOR . $name, $file, self::F_HD);
		}
1236978
public static function resource($path, $dest, $force = false)
    {
        $debug = Config::getParam('debug');
        $domains = Template::getDomains(true);
        $filenamePath = self::extractPathname($path, $domains);
        \PSFS\Services\GeneratorService::copyResources($dest, $force, $filenamePath, $debug);
        return '';
    }
1034452
protected function path($path, $type)
    {
        if (Configure::read('debug') && !Configure::read('Assets.force')) {
            return $path;
        }

        $asset = new AssetsCreator($path, $type);
        $path = '/assets/' . $asset->create();

        //Appends the timestamp
        $stamp = Configure::read('Asset.timestamp');
        if ($stamp === 'force' || ($stamp === true && Configure::read('debug'))) {
            $path = sprintf('%s.%s?%s', $path, $type, filemtime($asset->path()));
        }

        return $path;
    }
623667
protected function copyFileWithDirsCreating($src, $dest)
    {
        $dirPathOfDestFile = dirname($dest);

        if (! File::exists($dirPathOfDestFile)) {
            File::makeDirectory($dirPathOfDestFile, 0755, true);
        }

        if (! File::exists($dest)) {
            File::copy($src, $dest);
        }
    }
883092
protected function save($content, $path)
    {
        $handler = $this->openFileForWriting($path);

        $this->writeToFile($handler, $content);

        @fclose($handler);
    }
1184452
public function export($path = NULL, $mimetype = NULL) {

		if(!$mimetype) {
			$mimetype = $this->mimeType;
		}
		
		if(!preg_match('#^image/(?:'.implode('|', $this->supportedFormats).')$#', $mimetype)) {
			throw new ImageModifierException("$mimetype not supported by export.");
		}

		$this->path = $path ? $path : $this->file;

		// if image was not altered, create only copy

		if($this->mimeType == $mimetype && !count($this->queue)) {
			copy($this->file, $this->path);
		}

		else {

			$src = $this->src;
			
			foreach($this->queue as $step) {
				$this->destinationBuffer[$this->bufferNdx] = call_user_func_array(array($this, 'do_' . $step->method), array_merge(array($src), $step->parameters));
				$src = $this->destinationBuffer[$this->bufferNdx];
				$this->bufferNdx = ++$this->bufferNdx % 2;
			}
			
			switch($mimetype) {

				case 'image/jpeg':
					imagejpeg($src->resource, $this->path, 90);
					break;

				case 'image/png':
					imagepng($src->resource, $this->path, 5);
					break;

				case 'image/gif':
					imagegif($src->resource, $this->path);
					break;
			}
		}
		
	}
38539
protected static function copyRecursive( $src, $dest )
	{
		self::createDirectory( $dest );

		$iterator = new \RecursiveIteratorIterator(
			new \RecursiveDirectoryIterator( $src, \RecursiveDirectoryIterator::SKIP_DOTS ),
			\RecursiveIteratorIterator::SELF_FIRST
		);

		foreach( $iterator as $item )
		{
			$target = $dest . DIRECTORY_SEPARATOR . $iterator->getSubPathName();

			if( $item->isDir() === false )
			{
				if( copy( $item, $target ) === false ) {
					throw new \RuntimeException( sprintf( 'Unable to copy file "%1$s"', $item ) );
				}
			}
			else
			{
				self::createDirectory( $target );
			}
		}
	}
63859
public static function copy($src, $dest, $force = false)
    {
        @set_time_limit((int) ini_get('max_execution_time'));

        // Eliminate trailing directory separators, if any
        $src = rtrim($src, '/\\');
        $dest = rtrim($dest, '/\\');

        if (!is_dir($src)) {
            throw new FilesystemException('Source folder not found', -1);
        }

        if (is_dir($dest) && !$force) {
            throw new FilesystemException('Destination folder exists', -1);
        }

        // Make sure the destination exists
        if (!static::create($dest)) {
            throw new FilesystemException('Cannot create destination folder', -1);
        }

        $sources = static::items($src, true, static::PATH_RELATIVE);

        // Walk through the directory copying files and recursing into folders.
        foreach ($sources as $file) {
            $srcFile = $src . '/' . $file;
            $destFile = $dest . '/' . $file;

            if (is_dir($srcFile)) {
                static::create($destFile);
            } elseif (is_file($srcFile)) {
                File::copy($srcFile, $destFile, $force);
            }
        }

        return true;
    }
290343
public static function delete_img($path, $isfull = false, $fsencoding = '') {
        $path = strval($path);
        if ($path == '') {
            return;
        }
        if (!$isfull) {
            $path = WEB_ROOT . $path;
        }

        $path = self::conv_to($path, $fsencoding);
        $pinfo = pathinfo($path);
        $dir = $pinfo['dirname'] . '/';
        $name = $pinfo['filename'];
        $files = [];

        if ($dh = opendir($dir)) {
            while (($file = readdir($dh)) !== false) {
                if ($file == '.' || $file == '..') {
                    continue;
                }
                if (preg_match('/^' . $name . '_?.*$/i', $file)) {
                    $files[] = $dir . $file;
                }
            }
            closedir($dh);
        }

        foreach ($files as $one) {
            self::delete($one, true);
        }
    }
501649
function store( $fileName, $filePath, $type )
    {
        if ( !$this->IsProcessed )
            $this->process();
        $imageObject = $this->imageObject();
        switch( $type )
        {
            case 'png':
            {
                if ( !file_exists( $filePath ) )
                {
                    eZDir::mkdir( $filePath, false, true );
                }
                $fileFullPath = eZDir::path( array( $filePath, $fileName ) );
                ImagePNG( $imageObject, $fileFullPath );
                $this->StoredPath = $filePath;
                $this->StoredFile = $fileName;
                $this->StoredType = $type;
                return true;
            } break;

            case 'jpg':
            {
                if ( !file_exists( $filePath ) )
                {
                    eZDir::mkdir( $filePath, false, true );
                }
                ImageJPEG( $imageObject, eZDir::path( array( $filePath, $fileName ) ) );
                $this->StoredPath = $filePath;
                $this->StoredFile = $fileName;
                $this->StoredType = $type;
                return true;
            } break;

            default:
            {
                eZDebug::writeError( 'Image format not supported: ' . $type, __METHOD__ );
            }
        }
        return false;
    }
179669
public function write($path)
  {
    if ($this->srcImage->getExtension() == Image::IMAGE_TYPE_JPG) {
      imagejpeg($this->cuttedRessource, $path, $this->srcImage->getJpgQuality());
    } else if ($this->srcImage->getExtension() == Image::IMAGE_TYPE_PNG) {
      imagepng($this->cuttedRessource, $path, $this->srcImage->getPngCompression());
    } else {
      throw new \Exception('Impossible de générer l\'image : extension non supportée');
    }
  }
405034
public function saveFile($path, $data)
    {
        $storage = $data;

        if ($data instanceof Slice)
        {
            $storage = $data->asArray();
        }

        switch ($this->type)
        {
            case PHP:
                $result = '<?php'
                    . PHP_EOL
                    . PHP_EOL .
                    'return ' . var_export($storage, true) . ';';
                break;

            case YML:
                $result = \Symfony\Component\Yaml\Yaml::dump($storage);
                break;

            case JSON:
                $json = clone $this->helper->json();
                $json->addOption(JSON_PRETTY_PRINT);
                $result = $json->encode($storage);
                break;

            default:
                throw new Exceptions\TypeNotFound($this->type);
        }

        $filePath = $this->path($path);

        return file_put_contents($filePath, $result);
    }
244832
public function fromPath($path, $filetype = null)
    {
        $filesystem = new Filesystem;

        $file = new UploadedFile(
            $path,
            last(explode('/', $path)),
            $filetype ?: $filesystem->mimeType($path),
            $filesystem->size($path),
            null,
            true
        );

        return $this->store($file);
    }
1186766
public function run($path, $type)
    {
        $test = [
            'params' => [
                'image' => [
                    'medium' => [
                        'thumbnail' => [
                            'box' => [194, 194],
                            'mode' => 'outbound'
                        ],
                        'visible' => 'user', //checking role before outputing url
                    ],
                    'home' => [
                        'thumbnail' => [
                            'box' => [640, 480],
                            'mode' => 'inset',
                        ],
                        'watermark' => [
                            'watermarkFilename' => '@app/web/images/watermark.png',
                        ],
                    ],
                ],
            ],
        ];
        $path = urldecode($path);
        $image = Yii::$app->get('image');
        try {
            $image->show($path, $type);
        } catch (Exception $e) {
            Yii::error($e->getMessage());
        }
    }
718487
public function save($pathname, $type = null, $quality = 80, $interlace = true)
    {
        //自动获取图像类型
        if (is_null($type)) {
            $type = $this->info['type'];
        } else {
            $type = strtolower($type);
        }
        //保存图像
        if ('jpeg' == $type || 'jpg' == $type) {
            //JPEG图像设置隔行扫描
            imageinterlace($this->im, $interlace);
            imagejpeg($this->im, $pathname, $quality);
        } elseif ('gif' == $type && !empty($this->gif)) {
            $this->gif->save($pathname);
        } elseif ('png' == $type) {
            //设定保存完整的 alpha 通道信息
            imagesavealpha($this->im, true);
            //ImagePNG生成图像的质量范围从0到9的
            imagepng($this->im, $pathname, min((int) ($quality / 10), 9));
        } else {
            $fun = 'image' . $type;
            $fun($this->im, $pathname);
        }

        return $this;
    }
782064
public function export($path, $dest)
    {
        if (is_dir($dest)) {
            $dest = $dest . '/' . basename($path);
        }

        $this->dispatch(VcsEvents::PRE_EXPORT, new ExportEventData($this->getHead(), $path, $dest));

        $result = $this->execute('export', array($this->getSvnUrl($path), $dest));

        $this->dispatch(VcsEvents::POST_EXPORT, new ExportEventData($this->getHead(), $path, $dest));

        return $result;
    }
628393
private function SaveToPHP($path)
    {
        $this->definitions_path = rtrim($path, "/\\") . "/";
        $this->export_type = Type::PHP;
        
        $this->SendMessage(t("Creating constants.php"));
        $this->SaveConstantsToPHP();
        
        $this->SendMessage(t("Creating enumerations.php"));
        $this->SaveEnumerationsToPHP();
        
        $this->SendMessage(t("Creating type_definitions.php"));
        $this->SaveTypeDefToPHP();
        
        $this->SendMessage(t("Creating variables.php"));
        $this->SaveGloablVariablesToPHP();
        
        $this->SendMessage(t("Creating functions.php"));
        $this->SaveFunctionsToPHP();
        
        $this->SendMessage(t("Creating classes.php"));
        $this->SaveClassesToPHP();
    }