How to find out image width and height which is saved in database?


#1

How to find out image width and height which is saved in database,
with out using any applications or addons Please help


#2

On Apr 3, 2009, at 6:15 AM, seenu wrote:

How to find out image width and height which is saved in database,
with out using any applications or addons Please help

You could do what I did: http://gist.github.com/89738

Then you can do things like:

irb> require ‘image_size’
=> true
irb> x=ImageSize.of_file(’/Users/rab/Pictures/Boston_MIT_8L4L2442.jpg’)
=> #<ImageSize:0x32df98 @height=678, @image=#<File:/Users/rab/Pictures/
Boston_MIT_8L4L2442.jpg (closed)>, @width=1024,
@jpeg_dimension_segment="\377\300\000\021\b
\002\246\004\000\003\001"\000\002\021\001\003\021\001",
@header="\377\330\377\340\000\020JFIF\000\001\001\001\000\000
\000\000\377\333\000C\000\006\004\005\006\005\004\006\006\005\006\a\a
\006\b\n\020\n\n\t\t\n\024\016\017\f
\020\027\024\030\030\027\024\026\026\032\035%\037\032\e#\034\026\026 ,
#&’)*)\031\037-0-(0%()(\377\333\000C\001\a\a\a\n\b\n\023\n\n
\023
(\032
\026
\032
((((((((((((((((((((((((((((((((((((((((((((((((((\377\300\000\021\b
\002\246\004\000\003\001"\000\002\021\001\003\021\001\377\304",
@image_type=:jpeg>
irb> x.width
=> 1024
irb> x.height
=> 678
irb> x.dimensions
=> [1024, 678]
irb> x.size
=> “1024x678”
irb> x.content_type
=> “image/jpeg”

Well, unless you consider that an addon, of course.

-Rob

Rob B. http://agileconsultingllc.com
removed_email_address@domain.invalid