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:
@@ -97,11 +97,16 @@ class Image
|
|||||||
// set image properties
|
// set image properties
|
||||||
if ( ! is_null($source)) {
|
if ( ! is_null($source)) {
|
||||||
|
|
||||||
if (is_resource($source)) {
|
if ($this->isImageResource($source)) {
|
||||||
|
|
||||||
// image properties come from gd image resource
|
// image properties come from gd image resource
|
||||||
$this->setPropertiesFromResource($source);
|
$this->setPropertiesFromResource($source);
|
||||||
|
|
||||||
|
} elseif ($this->isBinary($source)) {
|
||||||
|
|
||||||
|
// image properties come from binary image string
|
||||||
|
$this->setPropertiesFromString($source);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// image properties come from image file
|
// image properties come from image file
|
||||||
@@ -147,10 +152,7 @@ class Image
|
|||||||
*/
|
*/
|
||||||
public static function raw($string)
|
public static function raw($string)
|
||||||
{
|
{
|
||||||
$image = new Image;
|
return new Image($string);
|
||||||
$image->setPropertiesFromString($string);
|
|
||||||
|
|
||||||
return $image;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user