diff --git a/src/Intervention/Image/Image.php b/src/Intervention/Image/Image.php index 2c4d3140..7d5a59b7 100644 --- a/src/Intervention/Image/Image.php +++ b/src/Intervention/Image/Image.php @@ -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) {