#NEWLINE# def _get_thumbnail_options( self , context , instance ) : #NEWLINE# #INDENT# '\n        Return the size and options of the thumbnail that should be inserted\n        ' #NEWLINE# ( width , height ) = ( None , None ) #NEWLINE# ( crop , upscale ) = ( False , False ) #NEWLINE# subject_location = False #NEWLINE# placeholder_width = context . get ( 'width' , None ) #NEWLINE# placeholder_height = context . get ( 'height' , None ) #NEWLINE# if instance . thumbnail_option : #NEWLINE# #INDENT# if instance . thumbnail_option . width : #NEWLINE# #INDENT# width = instance . thumbnail_option . width #NEWLINE# #UNINDENT# if instance . thumbnail_option . height : #NEWLINE# #INDENT# height = instance . thumbnail_option . height #NEWLINE# #UNINDENT# crop = instance . thumbnail_option . crop #NEWLINE# upscale = instance . thumbnail_option . upscale #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( instance . use_autoscale and placeholder_width ) : #NEWLINE# #INDENT# width = int ( placeholder_width ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if instance . width : #NEWLINE# #INDENT# width = instance . width #NEWLINE# #UNINDENT# #UNINDENT# if ( instance . use_autoscale and placeholder_height ) : #NEWLINE# #INDENT# height = int ( placeholder_height ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if instance . height : #NEWLINE# #INDENT# height = instance . height #NEWLINE# #UNINDENT# #UNINDENT# crop = instance . crop #NEWLINE# upscale = instance . upscale #NEWLINE# #UNINDENT# if instance . image : #NEWLINE# #INDENT# if instance . image . subject_location : #NEWLINE# #INDENT# subject_location = instance . image . subject_location #NEWLINE# #UNINDENT# if ( ( not height ) and width ) : #NEWLINE# #INDENT# height = int ( ( ( float ( width ) * float ( instance . image . height ) ) / float ( instance . image . width ) ) ) #NEWLINE# #UNINDENT# if ( ( not width ) and height ) : #NEWLINE# #INDENT# width = int ( ( ( float ( height ) * float ( instance . image . width ) ) / float ( instance . image . height ) ) ) #NEWLINE# #UNINDENT# if ( not width ) : #NEWLINE# #INDENT# width = instance . image . width #NEWLINE# #UNINDENT# if ( not height ) : #NEWLINE# #INDENT# height = instance . image . height #NEWLINE# #UNINDENT# #UNINDENT# return { #NEWLINE# #INDENT# 'size' : ( width , height ) , #NEWLINE# 'crop' : crop , #NEWLINE# 'upscale' : upscale , #NEWLINE# 'subject_location' : subject_location , #NEWLINE# #UNINDENT# }