src/components/ImageManager.php
public function saveImage ($path, $file, $resize = false)
		{
			$filename = UuidHelper::generate() . '.' . $file->extension;
			$name = $filename[ 0 ] . DIRECTORY_SEPARATOR . $filename[ 1 ] . DIRECTORY_SEPARATOR . $filename;
			$filepath = $path . DIRECTORY_SEPARATOR . $name;
			if ($resize)
			{
				$data = [];
				foreach ($this->_formats() as $format)
				{
					$method = '_save' . ucfirst($format);
					$this->$method($path, $name, $file->tempName);
					$data[ $format ] = $path . DIRECTORY_SEPARATOR . $name;
				}
				if (file_exists($filepath))
					return $data;
				else
					return false;
			}
			else
			{
				$this->_saveOriginal($path, $name, $file->tempName);

				if (file_exists($filepath))
					return [ self::F_ORIGINAL => $path . DIRECTORY_SEPARATOR . $name ];
				else
					return false;
			}
		}
public function saveImage ($path, $file, $resize = false)
		{
			$filename = UuidHelper::generate() . '.' . $file->extension;
			$name = $filename[ 0 ] . DIRECTORY_SEPARATOR . $filename[ 1 ] . DIRECTORY_SEPARATOR . $filename;
			$filepath = $path . DIRECTORY_SEPARATOR . $name;
			if ($resize)
			{
				$data = [];
				foreach ($this->_formats() as $format)
				{
					$method = '_save' . ucfirst($format);
					$this->$method($path, $name, $file->tempName);
					$data[ $format ] = $path . DIRECTORY_SEPARATOR . $name;
				}
				if (file_exists($filepath))
					return $data;
				else
					return false;
			}
			else
			{
				$this->_saveOriginal($path, $name, $file->tempName);

				if (file_exists($filepath))
					return [ self::F_ORIGINAL => $path . DIRECTORY_SEPARATOR . $name ];
				else
					return false;
			}
		}
public function saveImage ( $ path , $ file , $ resize = false ) { $ filename = UuidHelper :: generate ( ) . '.' . $ file -> extension ; $ name = $ filename [ 0 ] . DIRECTORY_SEPARATOR . $ filename [ 1 ] . DIRECTORY_SEPARATOR . $ filename ; $ filepath = $ path . DIRECTORY_SEPARATOR . $ name ; if ( $ resize ) { $ data = [ ] ; foreach ( $ this -> _formats ( ) as $ format ) { $ method = '_save' . ucfirst ( $ format ) ; $ this -> $ method ( $ path , $ name , $ file -> tempName ) ; $ data [ $ format ] = $ path . DIRECTORY_SEPARATOR . $ name ; } if ( file_exists ( $ filepath ) ) return $ data ; else return false ; } else { $ this -> _saveOriginal ( $ path , $ name , $ file -> tempName ) ; if ( file_exists ( $ filepath ) ) return [ self :: F_ORIGINAL => $ path . DIRECTORY_SEPARATOR . $ name ] ; else return false ; } }
Save all formats image.

@param string       $path The path to the file.
@param UploadedFile $file The path to the source file.

```php
return Yii::$app->image->saveImage('var/www/site/data/img/author', $image);
```
@return bool|string
Save all formats image .