180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
|
# File 'lib/boxr/files.rb', line 180
def thumbnail(file, min_height: nil, min_width: nil, max_height: nil, max_width: nil)
file_id = ensure_id(file)
uri = "#{FILES_URI}/#{file_id}/thumbnail.png"
query = {}
query[:min_height] = min_height unless min_height.nil?
query[:min_width] = min_width unless min_width.nil?
query[:max_height] = max_height unless max_height.nil?
query[:max_width] = max_width unless max_width.nil?
body, response = get(uri, query: query, success_codes: [302,202,200], process_response: false)
if(response.status==202 || response.status==302)
location = response.['Location'][0]
thumbnail, response = get(location, process_response: false)
else
thumbnail = body
end
thumbnail
end
|