zbox 0.0.4 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b2fda35a7a2f759947d4fca3c6da87a08070edd3
4
+ data.tar.gz: 6a83a237aac417a368d87c8acc58011fe876f4cf
5
+ SHA512:
6
+ metadata.gz: 78506db170daa8c94850d01b8f7db39ece74c962c1e544b3560c87d203766ccfce8fe9f3847c85a6e3093a3002ed1c65ffe8efede4d71ccc578bb10ceb351e45
7
+ data.tar.gz: 1274f3978938acf25842136e81dcf90e95f8353448e047bbcf1eedefc828fd3c32c6b276ac29cb6389807d70ee205202e8fce38253943e0981eaae550bc64733
@@ -1,29 +1,22 @@
1
1
  require "quick_magick"
2
2
  module Zbox
3
- module Qm
4
- def self.resize(filepath,opts={})
5
- allsize={:tinylogo=>[100,100],:small=>[160,112],:middle=>[320,224],:default=>[640,480]}
6
- if opts[:width] and opts[:height]
3
+ module Qm
4
+ def self.resize(filepath,opts={})
5
+ img = QuickMagick::Image.open(filepath).first
6
+ if opts[:width]
7
7
  mw = opts[:width]
8
+ elsif opts[:height]
8
9
  mh = opts[:height]
9
- elsif opts[:size]
10
- size = allsize[opts[:size]]
11
- mw,mh = size[0],size[1]
12
- else
13
- size = allsize[:default]
14
- mw,mh = size[0],size[1]
15
- end
16
-
17
- img = QuickMagick::Image.open(filepath).first
18
- w,h=img.width,img.height
19
- return if w<mw
10
+ end
11
+ mw ||= img.width
12
+ mh ||= img.height
13
+ puts "mw is ------------- #{mw}"
20
14
  if opts[:percent]
21
15
  img.resize opts[:percent]
22
- #img.save filepath
23
16
  else
24
- img.resize "#{mw}x#{mh}!"
17
+ img.resize "#{mw}x#{mh}"
25
18
  end
26
- img.save!
27
- end
19
+ img.save!
20
+ end
28
21
  end
29
22
  end
@@ -1,3 +1,3 @@
1
1
  module Zbox
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.7"
3
3
  end
@@ -6,13 +6,13 @@ Gem::Specification.new do |s|
6
6
  s.name = "zbox"
7
7
  s.version = Zbox::VERSION
8
8
  s.platform = Gem::Platform::RUBY
9
- s.add_dependency('quick_magick')
10
9
  # gem.executables = ['foo'] #note,it's the file name relative to 'bin/',not the project root
11
10
  s.authors = ["zxy"]
12
11
  s.email = ["zxy@qq.com"]
13
12
  s.homepage = "http://lajunta.qq.com/"
14
13
  s.summary = %q{zxy's ruby toolbox'}
15
14
  s.description = %q{zxy's ruby tool collections'}
15
+ s.licenses = "MIT"
16
16
 
17
17
  s.rubyforge_project = "zbox"
18
18
 
@@ -20,4 +20,5 @@ Gem::Specification.new do |s|
20
20
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
21
21
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
22
22
  s.require_paths = ["lib"]
23
+ s.add_runtime_dependency 'quick_magick', '~> 0'
23
24
  end
metadata CHANGED
@@ -1,30 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zbox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
5
- prerelease:
4
+ version: 0.0.7
6
5
  platform: ruby
7
6
  authors:
8
7
  - zxy
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-06-22 00:00:00.000000000 Z
11
+ date: 2016-07-11 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: quick_magick
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - "~>"
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  description: zxy's ruby tool collections'
@@ -34,7 +31,7 @@ executables: []
34
31
  extensions: []
35
32
  extra_rdoc_files: []
36
33
  files:
37
- - .gitignore
34
+ - ".gitignore"
38
35
  - lib/zbox.rb
39
36
  - lib/zbox/ext/array.rb
40
37
  - lib/zbox/ext/hash.rb
@@ -45,27 +42,27 @@ files:
45
42
  - lib/zbox/version.rb
46
43
  - zbox.gemspec
47
44
  homepage: http://lajunta.qq.com/
48
- licenses: []
45
+ licenses:
46
+ - MIT
47
+ metadata: {}
49
48
  post_install_message:
50
49
  rdoc_options: []
51
50
  require_paths:
52
51
  - lib
53
52
  required_ruby_version: !ruby/object:Gem::Requirement
54
- none: false
55
53
  requirements:
56
- - - ! '>='
54
+ - - ">="
57
55
  - !ruby/object:Gem::Version
58
56
  version: '0'
59
57
  required_rubygems_version: !ruby/object:Gem::Requirement
60
- none: false
61
58
  requirements:
62
- - - ! '>='
59
+ - - ">="
63
60
  - !ruby/object:Gem::Version
64
61
  version: '0'
65
62
  requirements: []
66
63
  rubyforge_project: zbox
67
- rubygems_version: 1.8.24
64
+ rubygems_version: 2.6.6
68
65
  signing_key:
69
- specification_version: 3
66
+ specification_version: 4
70
67
  summary: zxy's ruby toolbox'
71
68
  test_files: []