Get image dimensions

Discussion corner for Developers of Serendipity.
judebert
Regular
Posts: 2478
Joined: Sat Oct 15, 2005 6:57 am
Location: Orlando, FL
Contact:

Post by judebert »

So... very... busy...

Yes, I recently committed a change to functions_smarty.inc.php which exposed serendipity_getimagesize() as {serendipity_getImageSize file="file" assign="name"}.

It accepts an absolute filesystem path, an HTTP path, or the name of a template file.

The return value is the same as serendipity_getimagesize(), to wit, an array where $name[0] is the width, $name[1] is the height, and $name.mime is set to the mimetype. If the image is found and understood, it may also have a $name[2] as the mime type and $name[3] as the dimension string for an <img> tag.

I do intend to work on exposing the media database as well, but a XSS problem was just identified in the karma plugin. I'll be making sure it's not a problem as my first priority. Then, constraining thumbnails. Then, on to more Smarty media access.
Judebert
---
Website | Wishlist | PayPal
Post Reply