Extract Geo Location information during Paperclip processing
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib/paperclip
spec
.gitignore
.rspec
.travis.yml
Gemfile
LICENSE.txt
README.md
Rakefile
paperclip-location.gemspec

README.md

Location Paperclip::Processor

Build Status

Extracts GeoLocation data from an image during Paperclip processing and attaches it to the associated model.

Installation

Add this line to your application's Gemfile:

gem 'paperclip-location'

And then execute:

$ bundle

Or install it yourself as:

$ gem install paperclip-location

Usage

Use it like any other Paperclip::Processor

class Place < ActiveRecord::Base

  has_attached_file :photo, styles: { large: '600x600#' },
                    processors: [:thumbnail, :location]

end

The processor expects that the model in question has the following:

  • location_locked - a boolean flag to determine if the location has been manually overridden
  • lat - a decimal representing the latitude
  • lng - a decimal representing the longitude

If you don't have either, run a migration to add them

class AddLocationToPlaces < ActiveRecord::Migration
  def self.change
    add_column :places, :location_locked, :boolean, default: false, null: false
    add_column :places, :lat, :decimal, precision: 10, scale: 15
    add_column :places, :lng, :decimal, precision: 10, scale: 15
  end
end

These field names will be customizable in future versions

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request