diff options
Diffstat (limited to 'lib/class/core.class.php')
-rw-r--r-- | lib/class/core.class.php | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/class/core.class.php b/lib/class/core.class.php index 4818e39b..c1d07e86 100644 --- a/lib/class/core.class.php +++ b/lib/class/core.class.php @@ -87,5 +87,28 @@ class Core { } // form_verify + /** + * image_dimensions + * This returns the dimensions of the passed song of the passed type + * returns an empty array if PHP-GD is not currently installed, returns + * false on error + */ + public static function image_dimensions($image_data) { + + if (!function_exists('ImageCreateFromString')) { return false; } + + $image = ImageCreateFromString($image_data); + + if (!$image) { return false; } + + $width = imagesx($image); + $height = imagesy($image); + + if (!$width || !$height) { return false; } + + return array('width'=>$width,'heigh'=>$height); + + } // image_dimensions + } // Core ?> |