From 2a1731f70520059453d254b99238fcb19c309ddd Mon Sep 17 00:00:00 2001 From: xcephe Date: Sun, 16 May 2010 18:09:19 -0400 Subject: [PATCH] Fixed image-width and image-height helpers to function properly on Windows by forcing file reads in binary mode. --- lib/compass/sass_extensions/functions/image_size.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/compass/sass_extensions/functions/image_size.rb b/lib/compass/sass_extensions/functions/image_size.rb index c143faa8..d062f37e 100644 --- a/lib/compass/sass_extensions/functions/image_size.rb +++ b/lib/compass/sass_extensions/functions/image_size.rb @@ -38,11 +38,11 @@ private private def get_size_for_png - IO.read(@file)[0x10..0x18].unpack('NN') + File.open(@file, "rb") {|io| io.read}[0x10..0x18].unpack('NN') end def get_size_for_gif - size = IO.read(@file)[6..10].unpack('SS') + File.open(@file, "rb") {|io| io.read}[6..10].unpack('SS') end def get_size_for_jpg