[pmwiki-users] automatically generate image width/height?

Lucian Wischik lu.gmane at wischik.com
Wed Dec 6 23:34:39 CST 2006


Patrick R. Michaud <pmichaud <at> pobox.com> writes:
> The biggest obstacle is that this can only work for images where
> PmWiki knows the location of the image -- i.e., attachments.
> For images that are obtained via http:// or some other web
> address, PmWiki can't easily get the image size (except by doing
> a separate fetch of the image, which probably isn't a good idea).

Actually, it would be a MISTAKE to try to get the dimensions of
remote images. Doing so would involve a pmwiki<->image network
round-trip before pmwiki could start sending the page down to
the client, i.e. a pointless additional network communication.


> There's also the issue that many PHP configurations don't have
> the image processing libraries enabled, so there's not a reliable 
> method to inspect the .gif/.jpg images.

The PHP docs for getimagesize() say: "Note: The getimagesize()
function does not require the GD image library."

Before I read that note, I wrote up a small PHP routine to retrieve
the image size of PNG/GIF/JPEG by examining the file header:
http://www.wischik.com/lu/Programmer/GetImageSize


-- 
Lucian





More information about the pmwiki-users mailing list