mirror of
https://github.com/Intervention/image.git
synced 2025-08-27 15:50:09 +02:00
universal input possibility for constructor
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user