Ńň ŹKáHc@s‹dZddkZddkZddkZddkZdddgZd„Zd d„Zd d„Z d „Z e d jo e ƒndS( s#Multimedia helpers for images, etc.i˙˙˙˙Nt choose_heighttget_dimensions_piltget_dimensionscCs$t|ƒt|ƒ}t||ƒS(sReturn the height corresponding to ``new_width`` that's proportional to the original size (``width`` x ``height``). (tfloattint(t new_widthtwidththeightt proportion((s4/usr/lib/python2.6/site-packages/webhelpers/media.pyR scCs:ddk}y||ƒ}Wntj o|SX|iS(sĄGet an image's size using the Python Imaging Library (PIL) Returns ``(width, height)`` as two integers, or ``default`` if the size could not be ascertained. Failuer usually means the file does not exist or is not in a format recognized by PIL. Depends on the Python Imaging Library (http://pypi.python.org/pypi/PIL). See ``get_dimensions()`` if your application is not otherwise using PIL. i˙˙˙˙N(tImaget Exceptiontsize(tpathtdefaultR tim((s4/usr/lib/python2.6/site-packages/webhelpers/media.pyRs c CsŸtii|ƒ}yt|dƒ}Wntj o|SXzQ|idƒ}|idƒoôd}}|idƒxĎt oÇd}|i|ƒ}yt i d|ƒ\} } }Wnt j oPnX| djoPndt | ƒjo d jno1d }|i|ƒ}t i d |ƒ\}}qx|i|dƒqxW||fS|id ƒp|id ƒo_|idƒ|idƒ} | djo2|idƒ}t i d|ƒ\}}||fSn¸|idƒp|idƒoH|idƒ|idƒ}t i d|ƒ\}}} } }||fS|idƒo?|idƒ|idƒ}t i d|ƒ\}}||fS|SWd|iƒXdS(s(Get an image's size using only the Python standard library Returns ``(width, height)`` as two integers, or ``default`` if the size could not be ascertained. Failure usually means the file does not exist or is not in a recognized format. Only JPG/PNG/GIF/BMP are supported at this time. The algorithms are based on a PyCode recipe by Perenzo/Welch/Ray. (http://www.pycode.com/modules/?id=32&tab=download) This helper recognizes fewer image formats and is potentially less accurate than ``get_dimensions_pil()``. trbis˙Řiis!ccHs˙iŔiĂis!xHHs‰PNG  sŠMNG  i tIHDRtMHDRis!IItGIF87atGIF89aiiss       C