attachment_saver 1.4.1 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +13 -6
- data/lib/attachment_saver/version.rb +1 -1
- data/lib/processors/gdk_pixbuf.rb +4 -4
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4361cefbe15f73658b90fcdd5257d3f2dfedc449
|
|
4
|
+
data.tar.gz: 3667eabf22adae5ecdd045993b5a4882f0120f17
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9301f20ce8cc4c68e0873df7b6cb7c4bb41a1f119c7dad7e20d1486fad0f5acacbb59eeaf564476730d839c7699f7dc3a615e6e32cbe9c8defe541b4398c8f3d
|
|
7
|
+
data.tar.gz: 717eacc83e814b18d03b8857e28ccd8c89c97ef190cbab5c5fdedc3044ff329302b759fafd2ba9608b05d33c6f31894949d2ef45616f1a8d3eb8235bbe3c7058
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
attachment_saver (1.
|
|
4
|
+
attachment_saver (1.5.0)
|
|
5
5
|
activerecord
|
|
6
6
|
mimemagic
|
|
7
7
|
|
|
@@ -24,10 +24,16 @@ GEM
|
|
|
24
24
|
tzinfo (~> 1.1)
|
|
25
25
|
arel (9.0.0)
|
|
26
26
|
concurrent-ruby (1.0.5)
|
|
27
|
-
gdk_pixbuf2 (
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
gdk_pixbuf2 (3.2.1)
|
|
28
|
+
gio2 (= 3.2.1)
|
|
29
|
+
gio2 (3.2.1)
|
|
30
|
+
glib2 (= 3.2.1)
|
|
31
|
+
gobject-introspection (= 3.2.1)
|
|
32
|
+
glib2 (3.2.1)
|
|
33
|
+
native-package-installer (>= 1.0.3)
|
|
34
|
+
pkg-config (>= 1.2.2)
|
|
35
|
+
gobject-introspection (3.2.1)
|
|
36
|
+
glib2 (= 3.2.1)
|
|
31
37
|
i18n (0.9.1)
|
|
32
38
|
concurrent-ruby (~> 1.0)
|
|
33
39
|
image_science (1.3.0)
|
|
@@ -39,7 +45,8 @@ GEM
|
|
|
39
45
|
minitest (5.11.0)
|
|
40
46
|
mocha (1.3.0)
|
|
41
47
|
metaclass (~> 0.0.1)
|
|
42
|
-
|
|
48
|
+
native-package-installer (1.0.6)
|
|
49
|
+
pkg-config (1.2.9)
|
|
43
50
|
rake (12.3.0)
|
|
44
51
|
rmagick (2.16.0)
|
|
45
52
|
sqlite3 (1.3.13)
|
|
@@ -10,9 +10,9 @@ module AttachmentSaver
|
|
|
10
10
|
include Image
|
|
11
11
|
|
|
12
12
|
def with_image(filename, &block)
|
|
13
|
-
# we use
|
|
13
|
+
# we use GdkPixbuf::PixbufLoader rather than GdkPixbuf::Pixbuf.new(filename) so that we can learn the format of the
|
|
14
14
|
# image, which process_image wants to know so that it can save the derived images in the same format.
|
|
15
|
-
loader =
|
|
15
|
+
loader = ::GdkPixbuf::PixbufLoader.new
|
|
16
16
|
File.open(filename, "rb") do |file|
|
|
17
17
|
while buf = file.read(65536)
|
|
18
18
|
loader.write(buf)
|
|
@@ -27,7 +27,7 @@ module AttachmentSaver
|
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
def examine_image
|
|
30
|
-
fileinfo, width, height =
|
|
30
|
+
fileinfo, width, height = ::GdkPixbuf::Pixbuf.get_file_info(uploaded_file_path)
|
|
31
31
|
raise GdkPixbufProcessorError, "Not an image" if fileinfo.nil?
|
|
32
32
|
|
|
33
33
|
self.width = width if respond_to?(:width)
|
|
@@ -90,7 +90,7 @@ module AttachmentSaver
|
|
|
90
90
|
end
|
|
91
91
|
|
|
92
92
|
def crop_to(new_width, new_height, &block) # crops to the center
|
|
93
|
-
image =
|
|
93
|
+
image = new_subpixbuf((width - new_width)/2, (height - new_height)/2, new_width, new_height)
|
|
94
94
|
image.extend Operations
|
|
95
95
|
image.format = format
|
|
96
96
|
image.file_extension = file_extension
|
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
|
+
version: 1.5.0
|
|
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-
|
|
11
|
+
date: 2018-01-15 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activerecord
|