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:
parent
5f5e1c8768
commit
ab55fbb040
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user