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

added setPropertiesFromResource

This commit is contained in:
Oliver Vogel
2013-03-28 16:58:20 +01:00
parent 9db7709b62
commit d4ebd42853

View File

@@ -235,6 +235,24 @@ class Image
$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
*