No commit activity in last 3 years
No release in over 3 years
extract geolocation during Paperclip processing
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.3
~> 10.1
~> 2.14

Runtime

~> 1.1
>= 3.5
 Project Readme

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