By g99k on
Sorry if this is already answered somewhere, but I cannot figure out how to retrieve image data using the Drupal image module in PHP. I've tried the following code:
$imageName = 'some.jpg'; // given
$path = variable_get('image_default_path', 'images') .'/';
$path .= $imageName;
$size = getimagesize($path);
$width = $size['width'];
$height = $size['height'];
However, the path doesn't seem to be correct. I've searched the forum and the image.module code, but I couldn't find any code that does exactly this.
I'm new to Drupal and sadly don't have much PHP experience either. Thanks in advance for any suggestions.
GK
Comments
Found it!
Oh, I found it. There's lots of functions in the standard image toolkit in includes/image.inc. To get the image info, you have to know the node id though.
With all those different image plugins, I totally overlooked the existence of the image toolkit. In case this happens to others, here's the link to the Drupal image toolkits API:
http://api.drupal.org/api/group/image/6