-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated parameters of save and show functions
- Loading branch information
1 parent
a201ea1
commit aaa476d
Showing
4 changed files
with
14 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,7 @@ | |
) | ||
); | ||
|
||
$image->show(100); | ||
$image->show(); | ||
|
||
} catch(Exception $e) { | ||
echo $e->getMessage(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,7 @@ | |
* @package PosterEditor | ||
* @author Anton Lukin <[email protected]> | ||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php) | ||
* @version Release: 5.3 | ||
* @version Release: 5.4 | ||
* @link https://github.com/antonlukin/poster-editor | ||
*/ | ||
class PosterEditor | ||
|
@@ -214,10 +214,6 @@ public function canvas($width, $height, $options = array()) | |
*/ | ||
public function show($format = null, $quality = 90) | ||
{ | ||
if (empty($format)) { | ||
$format = pathinfo($path, PATHINFO_EXTENSION); | ||
} | ||
|
||
$this->setType($format); | ||
|
||
$quality = $this->getParam($quality, 0, 100); | ||
|
@@ -249,12 +245,12 @@ public function show($format = null, $quality = 90) | |
* Save the image. | ||
* | ||
* @param string $path Path to the file where to write the image data. | ||
* @param string $format Optional. File image extension. By default use from path. | ||
* @param integer $quality Optional. Define optionally the quality of the image. From 0 to 100. Default: 90. | ||
* @param string $format Optional. File image extension. By default use from path. | ||
* | ||
* @return $this | ||
*/ | ||
public function save($path, $format = null, $quality = 90) | ||
public function save($path, $quality = 90, $format = null) | ||
{ | ||
$folder = dirname($path); | ||
|
||
|
@@ -1009,17 +1005,17 @@ protected function setType($format) | |
$this->type = IMAGETYPE_GIF; | ||
break; | ||
|
||
case 'jpg': | ||
$this->type = IMAGETYPE_JPEG; | ||
break; | ||
|
||
case 'png': | ||
$this->type = IMAGETYPE_PNG; | ||
break; | ||
|
||
case 'webp': | ||
$this->type = IMAGETYPE_WEBP; | ||
break; | ||
|
||
case 'jpg': | ||
$this->type = IMAGETYPE_JPEG; | ||
break; | ||
} | ||
} | ||
|
||
|