5 def initialize base_dir = 'pettanr'
18 ['', 'v', 'h', 'vh', 'thumbnail']
22 sd = if subdir.to_s.empty?
30 def put(bindata, filename, subdir = nil)
31 AWS::S3::S3Object.store(dir(subdir) + filename, bindata, base)
34 def get(filename, subdir = nil)
36 # if AWS::S3::S3Object.exists?(fn, 'pettanr')
37 AWS::S3::S3Object.stream(dir(subdir) + filename, base) do |st|
44 iw, ih = Image.fix_size_both(80, 80, dt.columns, dt.rows)
48 vh = dt.flip.flop.to_blob
49 AWS::S3::S3Object.store(filename, n, 'pettanr')
50 AWS::S3::S3Object.store('v/' + filename, v, 'pettanr') if v
51 AWS::S3::S3Object.store('h/' + filename, h, 'pettanr') if h
52 AWS::S3::S3Object.store('vh/' + filename, vh, 'pettanr') if vh
54 t = Image.resize(dt.to_blob, iw, ih).to_blob
55 AWS::S3::S3Object.store('thumbnail/' + filename, t, 'pettanr')
60 # if AWS::S3::S3Object.exists?(fn, 'pettanr')
61 d = turn ? "#{turn}/" : ''
62 AWS::S3::S3Object.stream(d + filename, 'pettanr') do |st|