has-attached 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.4
1
+ 0.2.5
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "has-attached"
8
- s.version = "0.2.4"
8
+ s.version = "0.2.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["mcasimir"]
12
- s.date = "2012-09-24"
12
+ s.date = "2013-01-15"
13
13
  s.description = "ActiveRecordSchema attachments with Paperclip"
14
14
  s.email = "maurizio.cas@gmail.com"
15
15
  s.extra_rdoc_files = [
@@ -24,7 +24,8 @@ Gem::Specification.new do |s|
24
24
  "has-attached.gemspec",
25
25
  "lib/generators/has_attached/install_generator.rb",
26
26
  "lib/has-attached.rb",
27
- "lib/has-attached/engine.rb"
27
+ "lib/has-attached/engine.rb",
28
+ "lib/paperclip/auto_orient.rb"
28
29
  ]
29
30
  s.homepage = "http://github.com/mcasimir/kaminari-bootstrap"
30
31
  s.licenses = ["MIT"]
@@ -24,6 +24,7 @@ require 'aws-sdk'
24
24
  require 'paperclip'
25
25
  require 'flash_cookie_session'
26
26
  require 'has-attached/engine'
27
+ require 'paperclip/auto_orient'
27
28
 
28
29
  module HasAttached
29
30
  extend ActiveSupport::Concern
@@ -34,6 +35,7 @@ module HasAttached
34
35
 
35
36
  options[:url] ||= "/attachments/:class/:id/:attachment/:style/:basename.:extension"
36
37
  options[:path] ||= ":rails_root/public/attachments/:class/:id/:attachment/:style/:basename.:extension"
38
+ options[:processors] ||= [:auto_orient, :thumbnail]
37
39
 
38
40
  unless options[:styles]
39
41
  @all_styles ||= (YAML.load_file(Rails.root.join("config", "styles.yml")) rescue {"styles" => {}})["styles"]
@@ -0,0 +1,18 @@
1
+ require 'paperclip'
2
+
3
+ module Paperclip
4
+ class AutoOrient < Paperclip::Processor
5
+ def initialize(file, options = {}, *args)
6
+ @file = file
7
+ end
8
+
9
+ def make( *args )
10
+ dst = Tempfile.new([@basename, @format].compact.join("."))
11
+ dst.binmode
12
+
13
+ Paperclip.run('convert',"'#{File.expand_path(@file.path)}' -auto-orient #{File.expand_path(dst.path)}")
14
+
15
+ return dst
16
+ end
17
+ end
18
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: has-attached
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-24 00:00:00.000000000 Z
12
+ date: 2013-01-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -107,6 +107,7 @@ files:
107
107
  - lib/generators/has_attached/install_generator.rb
108
108
  - lib/has-attached.rb
109
109
  - lib/has-attached/engine.rb
110
+ - lib/paperclip/auto_orient.rb
110
111
  homepage: http://github.com/mcasimir/kaminari-bootstrap
111
112
  licenses:
112
113
  - MIT
@@ -122,7 +123,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
122
123
  version: '0'
123
124
  segments:
124
125
  - 0
125
- hash: -1252071158746481188
126
+ hash: 3415209096350516293
126
127
  required_rubygems_version: !ruby/object:Gem::Requirement
127
128
  none: false
128
129
  requirements: