dimension 0.0.1 → 0.0.2
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.
- data/README.md +14 -10
- data/benchmark.rb +5 -5
- data/examples/sinatra.rb +2 -2
- data/lib/dimension/version.rb +2 -2
- metadata +41 -21
- checksums.yaml +0 -7
data/README.md
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
Dimension
|
2
|
+
=========
|
3
3
|
|
4
4
|
Fast, simplified image resizing for Ruby. No ImageMagick.
|
5
5
|
|
6
6
|
``` rb
|
7
|
-
require '
|
7
|
+
require 'Dimension'
|
8
8
|
|
9
|
-
thumb =
|
9
|
+
thumb = Dimension.open('tux.png')
|
10
10
|
thumb.generate('100x100') # => { :width => 100, :height => 100 }
|
11
11
|
thumb.save('resized.png')
|
12
12
|
```
|
@@ -14,7 +14,7 @@ Fast, simplified image resizing for Ruby. No ImageMagick.
|
|
14
14
|
Or generate and write file automatically.
|
15
15
|
|
16
16
|
``` rb
|
17
|
-
thumb =
|
17
|
+
thumb = Dimension.new('tux.png')
|
18
18
|
thumb.generate!('100x300!') # will write file as 'tux-100x300.png'
|
19
19
|
```
|
20
20
|
|
@@ -23,7 +23,7 @@ Or generate and write file automatically.
|
|
23
23
|
Yes sir, we have it.
|
24
24
|
|
25
25
|
``` rb
|
26
|
-
thumb =
|
26
|
+
thumb = Dimension.open(params[:file])
|
27
27
|
thumb.generate('200x300#')
|
28
28
|
thumb.image_data
|
29
29
|
```
|
@@ -32,11 +32,10 @@ You can also pass a block, which will ensure the original image is closed after
|
|
32
32
|
|
33
33
|
``` rb
|
34
34
|
get '/resize/:file' do
|
35
|
-
thumb =
|
36
|
-
thumb.generate('200x300#') do
|
37
|
-
|
35
|
+
thumb = Dimension.open(params[:file])
|
36
|
+
thumb.generate('200x300#') do
|
37
|
+
thumb.to_response
|
38
38
|
end
|
39
|
-
@out.to_response
|
40
39
|
end
|
41
40
|
```
|
42
41
|
|
@@ -44,6 +43,11 @@ You can also pass a block, which will ensure the original image is closed after
|
|
44
43
|
|
45
44
|
This is taken directly from the excellent Dragonfly gem.
|
46
45
|
|
46
|
+
Author
|
47
|
+
======
|
48
|
+
|
49
|
+
Written by Tomás Pollak.
|
50
|
+
|
47
51
|
Copyright
|
48
52
|
=========
|
49
53
|
|
data/benchmark.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require './lib/
|
1
|
+
require './lib/dimension'
|
2
2
|
require 'benchmark'
|
3
3
|
|
4
4
|
file = ARGV[0] or abort('File needed')
|
@@ -10,8 +10,8 @@ puts "Processing #{file}"
|
|
10
10
|
Benchmark.bm do |x|
|
11
11
|
|
12
12
|
x.report do
|
13
|
-
|
14
|
-
a =
|
13
|
+
Dimension.processor = 'imlib2'
|
14
|
+
a = Dimension.open(file)
|
15
15
|
res = a.generate!(geometry)
|
16
16
|
puts res.inspect
|
17
17
|
end
|
@@ -19,8 +19,8 @@ Benchmark.bm do |x|
|
|
19
19
|
sleep 1
|
20
20
|
|
21
21
|
x.report do
|
22
|
-
|
23
|
-
b =
|
22
|
+
Dimension.processor = 'image_magick'
|
23
|
+
b = Dimension.open(file)
|
24
24
|
res = b.generate!(geometry)
|
25
25
|
puts res.inspect
|
26
26
|
end
|
data/examples/sinatra.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
ROOT = File.expand_path(File.dirname(__FILE__))
|
2
2
|
|
3
3
|
require 'sinatra'
|
4
|
-
require ROOT + '/../lib/
|
4
|
+
require ROOT + '/../lib/dimension'
|
5
5
|
|
6
6
|
get '/' do
|
7
7
|
images = Dir.glob(File.join(ROOT, 'assets') + '/*')
|
@@ -21,7 +21,7 @@ get '/images/:file' do
|
|
21
21
|
end
|
22
22
|
|
23
23
|
begin
|
24
|
-
thumb =
|
24
|
+
thumb = Dimension.open(file)
|
25
25
|
rescue => e
|
26
26
|
return e.message
|
27
27
|
end
|
data/lib/dimension/version.rb
CHANGED
metadata
CHANGED
@@ -1,24 +1,34 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: dimension
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 0
|
8
|
+
- 2
|
9
|
+
version: 0.0.2
|
5
10
|
platform: ruby
|
6
|
-
authors:
|
7
|
-
-
|
11
|
+
authors:
|
12
|
+
- "Tom\xC3\xA1s Pollak"
|
8
13
|
autorequire:
|
9
14
|
bindir: bin
|
10
15
|
cert_chain: []
|
11
|
-
|
16
|
+
|
17
|
+
date: 2014-04-04 00:00:00 -07:00
|
18
|
+
default_executable:
|
12
19
|
dependencies: []
|
20
|
+
|
13
21
|
description: Yes, there are other graphic libraries besides ImageMagick.
|
14
|
-
email:
|
22
|
+
email:
|
15
23
|
- tomas@forkhq.com
|
16
|
-
executables:
|
24
|
+
executables:
|
17
25
|
- dimension
|
18
26
|
extensions: []
|
27
|
+
|
19
28
|
extra_rdoc_files: []
|
20
|
-
|
21
|
-
|
29
|
+
|
30
|
+
files:
|
31
|
+
- .gitignore
|
22
32
|
- README.md
|
23
33
|
- Rakefile
|
24
34
|
- benchmark.rb
|
@@ -34,27 +44,37 @@ files:
|
|
34
44
|
- lib/dimension/processors/image_magick.rb
|
35
45
|
- lib/dimension/processors/imlib2.rb
|
36
46
|
- lib/dimension/version.rb
|
47
|
+
has_rdoc: true
|
37
48
|
homepage: https://github.com/tomas/dimension
|
38
49
|
licenses: []
|
39
|
-
|
50
|
+
|
40
51
|
post_install_message:
|
41
52
|
rdoc_options: []
|
42
|
-
|
53
|
+
|
54
|
+
require_paths:
|
43
55
|
- lib
|
44
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
45
|
-
requirements:
|
56
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
46
58
|
- - ">="
|
47
|
-
- !ruby/object:Gem::Version
|
48
|
-
|
49
|
-
|
50
|
-
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
segments:
|
61
|
+
- 0
|
62
|
+
version: "0"
|
63
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
51
65
|
- - ">="
|
52
|
-
- !ruby/object:Gem::Version
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
segments:
|
68
|
+
- 1
|
69
|
+
- 3
|
70
|
+
- 6
|
53
71
|
version: 1.3.6
|
54
72
|
requirements: []
|
73
|
+
|
55
74
|
rubyforge_project: dimension
|
56
|
-
rubygems_version:
|
75
|
+
rubygems_version: 1.3.6
|
57
76
|
signing_key:
|
58
|
-
specification_version:
|
77
|
+
specification_version: 3
|
59
78
|
summary: Native, in-process image resizing in Ruby.
|
60
79
|
test_files: []
|
80
|
+
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: d1be13d491cf7820b7fdd352dac29074884ee584
|
4
|
-
data.tar.gz: 1cf3a7360986cebb5d83089ad33b7fe85aa171b7
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: 1541bb58760ef65bb60df5342b7fe1f85ae9a5fc4b36d4ec896be9d204749eb38cd631e40748c61af7f341865fe2c5068b49cb6453307092f7e31f7d97f025a6
|
7
|
-
data.tar.gz: 7d992bb47aeaeb109d92cd3d0944912012bf4f29fb278c7375122bc5b37cbc8076246e0672f891dd9383696196f1f1d31c8d4f008c1718ae8059f6a9579111df
|