attachment_saver 1.4.0 → 1.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1ab301b6cb41a742a469e6570ee68098947546bf
4
- data.tar.gz: b2b922db15fc14b957f9fe6c3ef3ad7493ab4f3a
3
+ metadata.gz: 2f613638b5f3ecd862dba2228468bed04023b374
4
+ data.tar.gz: e61fa078f074c6e0837f0a10b8bbbbf52e1a53a1
5
5
  SHA512:
6
- metadata.gz: 73d1c02e925c5855493f40c313cd5320d169cfc55da1a613cdf15c15484c74e1406db90c18fed8dcb9d728dd4e89b0938fbe2cf3da2e08b092001e383684366f
7
- data.tar.gz: c7a870a119aca14f8fb6696841f13dc8fe6300eea0db95e317eb88cc6a0d226d5771d50d1ddd649b7198b9e8466dfeeaeb55e0aedf13cde0dd40cac9895b6e5f
6
+ metadata.gz: 7786d56eeb1702ad43f17c2aee9578214f5548b8318f350a8ed7125766bce4e6f1b516e98fe26133924e684b7b4f4d7c6c8cbb2ba83ce2a55f6274a905c43d84
7
+ data.tar.gz: cd36c76ef7100666a9589d232ea2291ce63f1405af5d8ce33cc9f4cac79c6e792a0d987b84ecfae92a86668ebbaa22ddb1209376fb61acb5d9bdefe84c232858
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- attachment_saver (1.4.0)
4
+ attachment_saver (1.4.1)
5
5
  activerecord
6
6
  mimemagic
7
7
 
@@ -1,3 +1,3 @@
1
1
  module AttachmentSaver
2
- VERSION = '1.4.0'
2
+ VERSION = '1.4.1'
3
3
  end
@@ -22,6 +22,7 @@ module AttachmentSaver
22
22
  image = loader.pixbuf
23
23
  image.extend(Operations)
24
24
  image.format = loader.format.name
25
+ image.file_extension = normalize_extension(loader.format.extensions.first)
25
26
  block.call(image)
26
27
  end
27
28
 
@@ -55,7 +56,7 @@ module AttachmentSaver
55
56
  # both original_filename and content_type must be defined for parents when using image processing
56
57
  # - but apps can just define them using attr_accessor if they don't want them persisted to db
57
58
  derived_content_type = content_type
58
- derived_extension = derived_image.file_type_extension
59
+ derived_extension = derived_image.file_extension
59
60
 
60
61
  # we leverage tempfiles as discussed in the uploaded_file method
61
62
  temp = ExtendedTempfile.new("asgtemp", tempfile_directory, derived_extension)
@@ -78,19 +79,13 @@ module AttachmentSaver
78
79
  module Operations
79
80
  include AttachmentSaver::Processors::Image::Operations
80
81
 
81
- attr_accessor :format
82
-
83
- def file_type_extension
84
- case format
85
- when 'jpeg' then 'jpg'
86
- else format.downcase
87
- end
88
- end
82
+ attr_accessor :format, :file_extension
89
83
 
90
84
  def resize_to(new_width, new_height, &block)
91
85
  image = scale(new_width, new_height)
92
86
  image.extend Operations
93
87
  image.format = format
88
+ image.file_extension = file_extension
94
89
  block.call(image)
95
90
  end
96
91
 
@@ -98,6 +93,7 @@ module AttachmentSaver
98
93
  image = Gdk::Pixbuf.new(self, (width - new_width)/2, (height - new_height)/2, new_width, new_height)
99
94
  image.extend Operations
100
95
  image.format = format
96
+ image.file_extension = file_extension
101
97
  block.call(image)
102
98
  end
103
99
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: attachment_saver
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Will Bryant
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-09 00:00:00.000000000 Z
11
+ date: 2018-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord