1
0
mirror of https://github.com/Intervention/image.git synced 2025-09-09 21:50:47 +02:00

removed repeated code

This commit is contained in:
Oliver Vogel
2013-03-28 17:51:29 +01:00
parent 92cb637475
commit 8c66d8f280

View File

@@ -98,13 +98,19 @@ class Image
if ( ! is_null($source)) { if ( ! is_null($source)) {
if (is_resource($source)) { if (is_resource($source)) {
// image properties come from gd image resource
$this->setPropertiesFromResource($source); $this->setPropertiesFromResource($source);
} else { } else {
// image properties come from image file
$this->setPropertiesFromPath($source); $this->setPropertiesFromPath($source);
} }
} else { } else {
// new empty resource
$this->setPropertiesEmpty($width, $height, $bgcolor); $this->setPropertiesEmpty($width, $height, $bgcolor);
} }
} }
@@ -117,15 +123,7 @@ class Image
*/ */
public static function make($source) public static function make($source)
{ {
$image = new Image; return new Image($source);
if (is_resource($source)) {
$image->setPropertiesFromResource($source);
} else {
$image->setPropertiesFromPath($source);
}
return $image;
} }
/** /**
@@ -138,10 +136,7 @@ class Image
*/ */
public static function canvas($width, $height, $bgcolor = null) public static function canvas($width, $height, $bgcolor = null)
{ {
$image = new Image; return new Image(null, $width, $height, $bgcolor);
$image->setPropertiesEmpty($width, $height, $bgcolor);
return $image;
} }
/** /**