balloon 1.1.6 → 1.1.7

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
  SHA256:
3
- metadata.gz: 1a6938e850836fb4a51cb1d5f840e266b9b894e166707be413a941c34a194e54
4
- data.tar.gz: 3151ccdd4aa1d532f4473bde20d257f2c3f5ef112bac2ebbb6149e99b508450b
3
+ metadata.gz: bba5d24f211be4448d34dd84ffbe355ea56a50fd6c5ac712ceb3237b662ed595
4
+ data.tar.gz: 2cc2eae99f948e15c60aa54a40439e341c53d5a15d5b9028e4bddc4bd2d8536c
5
5
  SHA512:
6
- metadata.gz: 110d09c92c28ef0ee19e30176c49a8014f1bf7a3e693fef56f67118a15d6f081a533afddcbd61e7acba94a2303d60f7e8e9278c21bcff52407e56c4cca900b01
7
- data.tar.gz: a19e28319a53c4e24f5851db6e86c3b36b909ffdf010d3ebe2987097c664d572c1b0f461dd83008c40b409c2f68418a428c65ee4a8dc9822c0dfee247f0060af
6
+ metadata.gz: 5f7a60fec492313632bebe0e2f0aff94793eb7be842345e3ac0d167eeccb5affaf756f8c6e94daa75b0a03298d0347c2d1f09a9c86d659964f1cb578c1674728
7
+ data.tar.gz: 3f58fca77193677d5b14e9c8902f918e9993ab2eeb7bdfbbb77545234d666c871d4daca443498aa31f6b232399c06ad812b58e703790e44a399492f90f39c534
@@ -29,6 +29,13 @@ module Balloon
29
29
  ["\xff\xd8\xff\xe1(.*){2}Exif", "image/jpeg"]
30
30
  ]
31
31
 
32
+ IMAGE_TYPE_LIST = {
33
+ "GIF" => "image/gif",
34
+ "JPEG" => "image/jpeg",
35
+ "PNG" => "image/png",
36
+ "WEBP" => "image/webp"
37
+ }
38
+
32
39
  IMAGE_EXT_LIST = {
33
40
  "image/gif" => "gif",
34
41
  "image/jpeg" => "jpg",
@@ -134,6 +141,11 @@ module Balloon
134
141
  end
135
142
  end
136
143
 
144
+ def self.get_mime_type(type)
145
+ return type if type =~ /.+\/.+/
146
+ IMAGE_TYPE_LIST[type]
147
+ end
148
+
137
149
  def self.get_extension(mime_type)
138
150
  IMAGE_EXT_LIST[mime_type]
139
151
  end
@@ -45,7 +45,7 @@ module Balloon
45
45
  def connection
46
46
  @connection ||= begin
47
47
  conn = Faraday.new(url: url)
48
- conn.basic_auth(login, pass) if login
48
+ conn.request(:authorization, :basic, login, pass) if login
49
49
  conn.build do |b|
50
50
  conn_build.call(b)
51
51
  end if conn_build
@@ -18,7 +18,7 @@ module Balloon
18
18
  total_size = handle_resize(image, ext, data)
19
19
  data[:total_size] = processed_img.size.to_i + total_size.to_i
20
20
 
21
- mime_type = processed_img.mime_type
21
+ mime_type = FileExtension.get_mime_type(processed_img.type)
22
22
  extension = FileExtension.get_extension(mime_type)
23
23
  filename = "#{image.basename}.#{extension}"
24
24
 
@@ -36,7 +36,7 @@ module Balloon
36
36
 
37
37
  def handle_original(file, ext)
38
38
  original_image = MiniMagick::Image.open(file.path)
39
- convert = MiniMagick::Tool::Convert.new
39
+ convert = MiniMagick.convert
40
40
  convert << file.path
41
41
 
42
42
  auto_orient!(original_image, convert)
@@ -58,7 +58,7 @@ module Balloon
58
58
  img = MiniMagick::Image.open(file.path)
59
59
  raise ProcessError, "process error" unless img
60
60
 
61
- convert = MiniMagick::Tool::Convert.new
61
+ convert = MiniMagick.convert
62
62
  convert << file.path
63
63
 
64
64
  auto_orient!(img, convert)
@@ -26,7 +26,7 @@ module Balloon
26
26
  uploader_file = down_url(up_file)
27
27
  end
28
28
 
29
- if up_file.is_a?(ActionDispatch::Http::UploadedFile)
29
+ if up_file.is_a?(::ActionDispatch::Http::UploadedFile)
30
30
  upload_data[:original_filename] = up_file.original_filename
31
31
  end
32
32
 
@@ -1,3 +1,3 @@
1
1
  module Balloon
2
- VERSION = "1.1.6"
2
+ VERSION = "1.1.7"
3
3
  end
data/lib/balloon.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require 'balloon/version'
2
2
  require 'active_support'
3
3
  require 'active_support/core_ext'
4
+ require 'action_dispatch'
4
5
 
5
6
  # Balloon
6
7
  module Balloon
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: balloon
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.6
4
+ version: 1.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - yeeli
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-07-15 00:00:00.000000000 Z
11
+ date: 2024-09-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -226,7 +226,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
226
226
  - !ruby/object:Gem::Version
227
227
  version: '0'
228
228
  requirements: []
229
- rubygems_version: 3.4.14
229
+ rubygems_version: 3.5.3
230
230
  signing_key:
231
231
  specification_version: 4
232
232
  summary: Ruby image upload libary