mirror of
https://github.com/Intervention/image.git
synced 2025-08-30 17:19:50 +02:00
added setPropertiesFromResource
This commit is contained in:
@@ -235,6 +235,24 @@ class Image
|
|||||||
$this->original['height'] = $this->height;
|
$this->original['height'] = $this->height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set image properties from GD image resource
|
||||||
|
*
|
||||||
|
* @param resource $resource
|
||||||
|
*/
|
||||||
|
private function setPropertiesFromResource($resource)
|
||||||
|
{
|
||||||
|
if (is_resource($resource)) {
|
||||||
|
$this->resource = $resource;
|
||||||
|
$this->width = imagesx($this->resource);
|
||||||
|
$this->height = imagesy($this->resource);
|
||||||
|
$this->original['width'] = $this->width;
|
||||||
|
$this->original['height'] = $this->height;
|
||||||
|
} else {
|
||||||
|
throw new Exception("setPropertiesFromResource expects parameter to be resource.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set properties for empty image resource
|
* Set properties for empty image resource
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user