1
0
mirror of https://github.com/Intervention/image.git synced 2025-01-17 20:28:21 +01:00

added the $format parameter to the save method

This commit is contained in:
Babichev Maxim 2019-06-07 18:04:55 +03:00
parent 5f5e1c8768
commit ab55fbb040
No known key found for this signature in database
GPG Key ID: B171CF93F76DED4D

View File

@ -126,9 +126,10 @@ class Image extends File
*
* @param string $path
* @param int $quality
* @param string $format
* @return \Intervention\Image\Image
*/
public function save($path = null, $quality = null)
public function save($path = null, $quality = null, $format = null)
{
$path = is_null($path) ? $this->basePath() : $path;
@ -138,7 +139,11 @@ class Image extends File
);
}
$data = $this->encode(pathinfo($path, PATHINFO_EXTENSION), $quality);
if ($format === null) {
$format = pathinfo($path, PATHINFO_EXTENSION);
}
$data = $this->encode($format, $quality);
$saved = @file_put_contents($path, $data);
if ($saved === false) {