1
0
mirror of https://github.com/Intervention/image.git synced 2025-08-27 07:44:30 +02:00

universal input possibility for constructor

This commit is contained in:
Oliver Vogel
2013-03-28 20:12:39 +01:00
parent 310aa0ae1f
commit 6d7e1bf5bf

View File

@@ -97,11 +97,16 @@ class Image
// set image properties
if ( ! is_null($source)) {
if (is_resource($source)) {
if ($this->isImageResource($source)) {
// image properties come from gd image resource
$this->setPropertiesFromResource($source);
} elseif ($this->isBinary($source)) {
// image properties come from binary image string
$this->setPropertiesFromString($source);
} else {
// image properties come from image file
@@ -147,10 +152,7 @@ class Image
*/
public static function raw($string)
{
$image = new Image;
$image->setPropertiesFromString($string);
return $image;
return new Image($string);
}
/**