class Pettanr.Imager @thumbnail_size: (w, h) -> lw = Manifest.manifest().magic_numbers['thumbnail_width'] lh = Manifest.manifest().magic_numbers['thumbnail_height'] Pettanr.Imager.fix_size_both lw, lh, w, h @fix_size_both: (limw, limh, w, h)-> wr = if w > limw limw*100/w else 100 hr = if h > limh limh*100/h else 100 r = if wr < hr [Math.floor(w*wr/100), Math.floor(h*wr/100)] else [Math.floor(w*hr/100), Math.floor(h*hr/100)] r