def _scale_dimensions(width, height, longest_side=settings.THUMBNAIL_SIZE):
 if ((width < longest_side) and (height < longest_side)):
  return (width, height)
 if (width > height):
  new_width = longest_side
  new_height = ((new_width * height) / width)
  return (new_width, new_height)
 new_height = longest_side
 new_width = ((new_height * width) / height)
 return (new_width, new_height)

def _scale_dimensions ( width , height , longest_side = settings . THUMBNAIL_SIZE ) : if ( ( width < longest_side ) and ( height < longest_side ) ) : return ( width , height ) if ( width > height ) : new_width = longest_side new_height = ( ( new_width * height ) / width ) return ( new_width , new_height ) new_height = longest_side new_width = ( ( new_height * width ) / height ) return ( new_width , new_height )
returns a tuple .