Skip to content

Instantly share code, notes, and snippets.

@spritle
Created October 25, 2011 06:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spritle/1311489 to your computer and use it in GitHub Desktop.
Save spritle/1311489 to your computer and use it in GitHub Desktop.
Upload image from Rhodes and read exif.gps data using RoR
------------inspect exif_info.exif--------------
[{:orientation=>#<EXIFR::TIFF::Orientation:TopLeft(1)>, :color_space=>1, :pixel_x_dimension=>320,
:pixel_y_dimension=>239}]
-----------inspect exif_info.gps--------------
nil
------------inspect exif_info.exif--------------
[{:orientation=>#<EXIFR::TIFF::Orientation:TopLeft(1)>, :color_space=>1, :pixel_x_dimension=>320,
:pixel_y_dimension=>320}]
-----------inspect exif_info.gps--------------
nil
------------inspect exif_info.exif--------------
[{:make=>"Apple", :model=>"iPad 2", :orientation=>#<EXIFR::TIFF::Orientation:BottomRight(3)>, :x_resolution=>
(72/1), :y_resolution=>(72/1), :resolution_unit=>2, :software=>"5.0", :date_time=>2011-10-24 15:42:10 +0530,
:ycb_cr_positioning=>1, :exposure_time=>(1/30), :f_number=>(12/5), :exposure_program=>2,
:iso_speed_ratings=>400, :date_time_original=>2011-10-24 15:42:10 +0530, :date_time_digitized=>2011-10-24
15:42:10 +0530, :shutter_speed_value=>(6325/1289), :aperture_value=>(4845/1918), :brightness_value=>
(10063/6829), :metering_mode=>5, :flash=>32, :focal_length=>(203/100), :color_space=>1, :pixel_x_dimension=>960,
:pixel_y_dimension=>720, :sensing_method=>2, :exposure_mode=>0, :white_balance=>0,
:focal_length_in_35mm_film=>32, :scene_capture_type=>0, :sharpness=>0, :gps_latitude_ref=>"N", :gps_latitude=>
[(13/1), (283/100), (0/1)], :gps_longitude_ref=>"E", :gps_longitude=>[(80/1), (1189/100), (0/1)],
:gps_altitude_ref=>"\x00", :gps_altitude=>(26091/1024), :gps_time_stamp=>[(10/1), (12/1), (583/1)],
:gps_img_direction_ref=>"T", :gps_img_direction=>(37651/106)}, {:compression=>6, :x_resolution=>(72/1),
:y_resolution=>(72/1), :resolution_unit=>2, :jpeg_interchange_format=>874,
:jpeg_interchange_format_length=>7610}]
-----------inspect exif_info.gps--------------
#<struct EXIFR::TIFF::GPS latitude=13.047166666666667, longitude=80.19816666666668, altitude=25.4794921875,
image_direction=355.1981132075472>
def choose_picture
Camera::choose_picture(url_for :action => :choose_picture_callback)
end
def choose_picture_callback
@@image = @params["image_uri"]
# WebView.navigate(<display chosen image on .erb file>)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment