Monday, November 08, 2010 at 12:03 AM.

system.verbs.builtins.html.getGifHeightWidth

on getGifHeightWidth (f) {
	<<Change notes:
		<<7/30/97 PBS: f can be an address or a file path.
		<<10/31/97 at 8:19:56 AM by DW -- moved from toys.getGifHeightWidth
			<<Old script version:
				<<local (signature, version, height, width, s, t, hwlist = {})
				<<signature = string (file.read (path, 3))
				<<version = string (file.read (path, 3))
				<<s = file.read (path, 1) << reverse byte order
				<<t = file.read (path, 1)
				<<if sys.os() == "MacOS"
					<<width = number (t + s)
				<<else
					<<width = number (s + t)
				<<s = file.read (path, 1)
				<<t = file.read (path, 1)
				<<if sys.os() == "MacOS"
					<<height = number (t + s)
				<<else
					<<height = number (s + t)
				<<file.close (path)
				<<hwList = hwList + height
				<<hwList = hwList + width
				<<return (hwList)
		<<5/19/96 MAH
			<<takes file path to gif image as parameter
			<<returns list {height, width} of image in pixels
	if typeOf (f) == addressType {
		on numberFromBytes (ix) {
			local (low = string.mid (string.hex (f^ [ix]), 5, 2));
			local (hi = string.mid (string.hex (f^ [ix + 1]), 5, 2));
			return (number ("0x" + hi + low))};
		return ({numberFromBytes (9), numberFromBytes (7)})}; //{height, width}
	on kernelcall (f) {
		kernel (string.getGifHeightWidth)};
	return (kernelcall (f))}



This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.