Pulling geo-location from photos with Rails has never been easier.
Paperclip is a file attachment gem from the good folks at Thoughtbot. Paperclip-Location is a
Paperclip::Processor that extracts an image's
The processor requires works with
ActiveRecord models, and requires 3 fields:
lat- a decimal representing the latitude
lng- a decimal representing the longitude
location_locked- a boolean flag to determine if the location has been manually set. During image processing, if the
location_lockedfield is true, the record's current location will remain and
EXIFprocessing will be skipped.
First, add them to the table with a migration.
:location in the array of
Paperclip::Processors within the
paperclip-location expects that processed files are images with
EXIF metadata. To require this, add a
Paperclip validation on
Now, whenever an image with
GPS information in its
EXIF headers is attached to a
lng fields will automatically be updated.