imageproxy 0.1.4 → 0.2.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.
- data/README.mdown +17 -7
- data/VERSION +1 -1
- data/imageproxy.gemspec +6 -6
- data/lib/imageproxy/command.rb +1 -1
- data/lib/imageproxy/server.rb +1 -0
- data/spec/command_spec.rb +7 -3
- metadata +139 -97
data/README.mdown
CHANGED
@@ -32,11 +32,13 @@ This project is pretty new. There are definitely some improvements that can be/n
|
|
32
32
|
|
33
33
|
Feel free to help out with some of these :)
|
34
34
|
|
35
|
-
*
|
36
|
-
*
|
37
|
-
* signature generation testing tool
|
35
|
+
* specify crop size and offset
|
36
|
+
* create rounded corners
|
38
37
|
* try mounting inside a Rails app
|
39
38
|
* Rails helper for generating image tags that use imageproxy
|
39
|
+
* X-Sendfile / X-Accel-Redirect header
|
40
|
+
* better documentation
|
41
|
+
* signature generation testing tool
|
40
42
|
* package as a gem?
|
41
43
|
* nice error messages for improper API use
|
42
44
|
* performance
|
@@ -99,10 +101,6 @@ There are two major functions: `identify` and `convert`, plus a helpful `selftes
|
|
99
101
|
|
100
102
|
`signature` To stop unauthorized use. See the "Signing Requests" section of this document.
|
101
103
|
|
102
|
-
`allowed_domains` A comma-separated list of second-level domains (e.g., "example.com, example.org") that are valid domains for the `source` parameter. If not specified, then the `source` parameter can reference any domain.
|
103
|
-
|
104
|
-
`max_size` The maximum dimension allowed for a `resize` or `thumbnail` operation. Specifying `20` would cause a resize of `10x30` to fail because the maximum dimension of `20` is less than the largest requested dimension of `30`.
|
105
|
-
|
106
104
|
### Request Format
|
107
105
|
|
108
106
|
The request must start with `identify` or `convert` (for backwards-compatibility, `process` is a synonym for `convert`).
|
@@ -150,6 +148,18 @@ Example Ruby code to generate the signature:
|
|
150
148
|
digest = OpenSSL::Digest::Digest.new("sha1")
|
151
149
|
Base64.encode64(OpenSSL::HMAC.digest(digest, your_secret_key, your_query_string)).strip.tr('+/', '-_')
|
152
150
|
|
151
|
+
### Other Server Configuration
|
152
|
+
|
153
|
+
`IMAGEPROXY_TIMEOUT` maximum duration (in whole seconds) for downloading a source image (not recommended if you're using Ruby 1.8)
|
154
|
+
|
155
|
+
`IMAGEPROXY_CACHE_TIME` value of the max-age header for the converted image
|
156
|
+
|
157
|
+
`IMAGEPROXY_VERBOSE` enables full Ruby stacktraces in your error log
|
158
|
+
|
159
|
+
`IMAGEPROXY_ALLOWED_DOMAINS` A comma-separated list of second-level domains (e.g., "example.com, example.org") that are valid domains for the `source` parameter. If not specified, then the `source` parameter can reference any domain.
|
160
|
+
|
161
|
+
`IMAGEPROXY_MAX_SIZE` The maximum dimension allowed for a `resize` or `thumbnail` operation. Specifying `20` would cause a resize of `10x30` to fail because the maximum dimension of `20` is less than the largest requested dimension of `30`.
|
162
|
+
|
153
163
|
### Obfuscating Requests
|
154
164
|
|
155
165
|
You may obfuscate your requests by Base64 encoding and then URL encoding your query string or path. The parameter name for this encoded value is `_` if you're using a query string or `-` if you're using a path. Example:
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
data/imageproxy.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{imageproxy}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.2.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = [
|
12
|
-
s.date = %q{2011-08-
|
11
|
+
s.authors = ["Erik Hanson"]
|
12
|
+
s.date = %q{2011-08-28}
|
13
13
|
s.description = %q{A image processing proxy server, written in Ruby as a Rack application. Requires ImageMagick.}
|
14
14
|
s.email = %q{erik@eahanson.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -48,9 +48,9 @@ Gem::Specification.new do |s|
|
|
48
48
|
"spec/spec_helper.rb"
|
49
49
|
]
|
50
50
|
s.homepage = %q{http://github.com/eahanson/imageproxy}
|
51
|
-
s.licenses = [
|
52
|
-
s.require_paths = [
|
53
|
-
s.rubygems_version = %q{1.
|
51
|
+
s.licenses = ["MIT"]
|
52
|
+
s.require_paths = ["lib"]
|
53
|
+
s.rubygems_version = %q{1.5.2}
|
54
54
|
s.summary = %q{A image processing proxy server, written in Ruby as a Rack application.}
|
55
55
|
|
56
56
|
if s.respond_to? :specification_version then
|
data/lib/imageproxy/command.rb
CHANGED
@@ -4,7 +4,7 @@ module Imageproxy
|
|
4
4
|
|
5
5
|
def execute_command(command_line)
|
6
6
|
stdin, stdout, stderr, wait_thr = Open3.popen3(command_line)
|
7
|
-
raise "Child process exited with non-zero exit code" unless wait_thr.value.success?
|
7
|
+
raise "Child process exited with non-zero exit code" unless wait_thr.nil? || wait_thr.value.success?
|
8
8
|
[output_to_string(stdout), output_to_string(stderr)].join("")
|
9
9
|
end
|
10
10
|
|
data/lib/imageproxy/server.rb
CHANGED
data/spec/command_spec.rb
CHANGED
@@ -25,9 +25,13 @@ describe Imageproxy::Command do
|
|
25
25
|
|
26
26
|
context "when the command exits with a non-zero status" do
|
27
27
|
it "should raise an exception" do
|
28
|
-
|
29
|
-
|
30
|
-
|
28
|
+
ruby_19 = RUBY_VERSION.split(".").map(&:to_i)[1] == 9
|
29
|
+
|
30
|
+
if ruby_19
|
31
|
+
lambda {
|
32
|
+
Imageproxy::Command.new.send(:execute_command, "ls /asdkljasldkjaskl")
|
33
|
+
}.should raise_exception
|
34
|
+
end
|
31
35
|
end
|
32
36
|
end
|
33
37
|
end
|
metadata
CHANGED
@@ -1,124 +1,159 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: imageproxy
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 2
|
9
|
+
- 0
|
10
|
+
version: 0.2.0
|
6
11
|
platform: ruby
|
7
|
-
authors:
|
12
|
+
authors:
|
8
13
|
- Erik Hanson
|
9
14
|
autorequire:
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
17
|
+
|
18
|
+
date: 2011-08-28 00:00:00 -07:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
15
22
|
name: rack
|
16
|
-
|
23
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
17
24
|
none: false
|
18
|
-
requirements:
|
19
|
-
- -
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
|
22
|
-
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 3
|
29
|
+
segments:
|
30
|
+
- 0
|
31
|
+
version: "0"
|
23
32
|
prerelease: false
|
24
|
-
|
25
|
-
|
33
|
+
type: :runtime
|
34
|
+
requirement: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
26
36
|
name: rake
|
27
|
-
|
37
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
28
38
|
none: false
|
29
|
-
requirements:
|
30
|
-
- -
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
|
33
|
-
|
39
|
+
requirements:
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
hash: 3
|
43
|
+
segments:
|
44
|
+
- 0
|
45
|
+
version: "0"
|
34
46
|
prerelease: false
|
35
|
-
|
36
|
-
|
47
|
+
type: :runtime
|
48
|
+
requirement: *id002
|
49
|
+
- !ruby/object:Gem::Dependency
|
37
50
|
name: mime-types
|
38
|
-
|
51
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
39
52
|
none: false
|
40
|
-
requirements:
|
41
|
-
- -
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
|
44
|
-
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
hash: 3
|
57
|
+
segments:
|
58
|
+
- 0
|
59
|
+
version: "0"
|
45
60
|
prerelease: false
|
46
|
-
|
47
|
-
|
61
|
+
type: :runtime
|
62
|
+
requirement: *id003
|
63
|
+
- !ruby/object:Gem::Dependency
|
48
64
|
name: heroku
|
49
|
-
|
65
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
50
66
|
none: false
|
51
|
-
requirements:
|
52
|
-
- -
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
|
55
|
-
|
67
|
+
requirements:
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
hash: 3
|
71
|
+
segments:
|
72
|
+
- 0
|
73
|
+
version: "0"
|
56
74
|
prerelease: false
|
57
|
-
|
58
|
-
|
75
|
+
type: :development
|
76
|
+
requirement: *id004
|
77
|
+
- !ruby/object:Gem::Dependency
|
59
78
|
name: shotgun
|
60
|
-
|
79
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
61
80
|
none: false
|
62
|
-
requirements:
|
63
|
-
- -
|
64
|
-
- !ruby/object:Gem::Version
|
65
|
-
|
66
|
-
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
hash: 3
|
85
|
+
segments:
|
86
|
+
- 0
|
87
|
+
version: "0"
|
67
88
|
prerelease: false
|
68
|
-
|
69
|
-
|
89
|
+
type: :development
|
90
|
+
requirement: *id005
|
91
|
+
- !ruby/object:Gem::Dependency
|
70
92
|
name: rspec
|
71
|
-
|
93
|
+
version_requirements: &id006 !ruby/object:Gem::Requirement
|
72
94
|
none: false
|
73
|
-
requirements:
|
74
|
-
- -
|
75
|
-
- !ruby/object:Gem::Version
|
76
|
-
|
77
|
-
|
95
|
+
requirements:
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
hash: 3
|
99
|
+
segments:
|
100
|
+
- 0
|
101
|
+
version: "0"
|
78
102
|
prerelease: false
|
79
|
-
|
80
|
-
|
103
|
+
type: :development
|
104
|
+
requirement: *id006
|
105
|
+
- !ruby/object:Gem::Dependency
|
81
106
|
name: rack-test
|
82
|
-
|
107
|
+
version_requirements: &id007 !ruby/object:Gem::Requirement
|
83
108
|
none: false
|
84
|
-
requirements:
|
85
|
-
- -
|
86
|
-
- !ruby/object:Gem::Version
|
87
|
-
|
88
|
-
|
109
|
+
requirements:
|
110
|
+
- - ">="
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
hash: 3
|
113
|
+
segments:
|
114
|
+
- 0
|
115
|
+
version: "0"
|
89
116
|
prerelease: false
|
90
|
-
|
91
|
-
|
117
|
+
type: :development
|
118
|
+
requirement: *id007
|
119
|
+
- !ruby/object:Gem::Dependency
|
92
120
|
name: awesome_print
|
93
|
-
|
121
|
+
version_requirements: &id008 !ruby/object:Gem::Requirement
|
94
122
|
none: false
|
95
|
-
requirements:
|
96
|
-
- -
|
97
|
-
- !ruby/object:Gem::Version
|
98
|
-
|
99
|
-
|
123
|
+
requirements:
|
124
|
+
- - ">="
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
hash: 3
|
127
|
+
segments:
|
128
|
+
- 0
|
129
|
+
version: "0"
|
100
130
|
prerelease: false
|
101
|
-
|
102
|
-
|
131
|
+
type: :development
|
132
|
+
requirement: *id008
|
133
|
+
- !ruby/object:Gem::Dependency
|
103
134
|
name: jeweler
|
104
|
-
|
135
|
+
version_requirements: &id009 !ruby/object:Gem::Requirement
|
105
136
|
none: false
|
106
|
-
requirements:
|
107
|
-
- -
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
|
110
|
-
|
137
|
+
requirements:
|
138
|
+
- - ">="
|
139
|
+
- !ruby/object:Gem::Version
|
140
|
+
hash: 3
|
141
|
+
segments:
|
142
|
+
- 0
|
143
|
+
version: "0"
|
111
144
|
prerelease: false
|
112
|
-
|
113
|
-
|
114
|
-
|
145
|
+
type: :development
|
146
|
+
requirement: *id009
|
147
|
+
description: A image processing proxy server, written in Ruby as a Rack application. Requires ImageMagick.
|
115
148
|
email: erik@eahanson.com
|
116
149
|
executables: []
|
150
|
+
|
117
151
|
extensions: []
|
118
|
-
|
152
|
+
|
153
|
+
extra_rdoc_files:
|
119
154
|
- LICENSE.txt
|
120
155
|
- README.mdown
|
121
|
-
files:
|
156
|
+
files:
|
122
157
|
- .document
|
123
158
|
- Gemfile
|
124
159
|
- Gemfile.lock
|
@@ -148,32 +183,39 @@ files:
|
|
148
183
|
- spec/server_spec.rb
|
149
184
|
- spec/signature_spec.rb
|
150
185
|
- spec/spec_helper.rb
|
186
|
+
has_rdoc: true
|
151
187
|
homepage: http://github.com/eahanson/imageproxy
|
152
|
-
licenses:
|
188
|
+
licenses:
|
153
189
|
- MIT
|
154
190
|
post_install_message:
|
155
191
|
rdoc_options: []
|
156
|
-
|
192
|
+
|
193
|
+
require_paths:
|
157
194
|
- lib
|
158
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
195
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
159
196
|
none: false
|
160
|
-
requirements:
|
161
|
-
- -
|
162
|
-
- !ruby/object:Gem::Version
|
163
|
-
|
164
|
-
segments:
|
197
|
+
requirements:
|
198
|
+
- - ">="
|
199
|
+
- !ruby/object:Gem::Version
|
200
|
+
hash: 3
|
201
|
+
segments:
|
165
202
|
- 0
|
166
|
-
|
167
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
203
|
+
version: "0"
|
204
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
168
205
|
none: false
|
169
|
-
requirements:
|
170
|
-
- -
|
171
|
-
- !ruby/object:Gem::Version
|
172
|
-
|
206
|
+
requirements:
|
207
|
+
- - ">="
|
208
|
+
- !ruby/object:Gem::Version
|
209
|
+
hash: 3
|
210
|
+
segments:
|
211
|
+
- 0
|
212
|
+
version: "0"
|
173
213
|
requirements: []
|
214
|
+
|
174
215
|
rubyforge_project:
|
175
|
-
rubygems_version: 1.
|
216
|
+
rubygems_version: 1.5.2
|
176
217
|
signing_key:
|
177
218
|
specification_version: 3
|
178
219
|
summary: A image processing proxy server, written in Ruby as a Rack application.
|
179
220
|
test_files: []
|
221
|
+
|