Skip to content

Instantly share code, notes, and snippets.

@azisaka
Created September 3, 2008 23:06
Show Gist options
  • Save azisaka/8690 to your computer and use it in GitHub Desktop.
Save azisaka/8690 to your computer and use it in GitHub Desktop.
size = size.map { |s| s.to_f }
aspect = size[0] > size[1] ? size[1]/size[0] : size[0]/size[1]
mould = thumb[0] > thumb[1] ? thumb[1] : thumb[0]
resize = [mould, aspect * mould]
resize = resize.reverse if size[1] > size[0]
resize
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment