(attachment, suffix)
return url
Return url of an image given size(@param suffix)
    e.g large, medium, small, or generate required thumbnail
Return url of an image given size(
Return url of an image given size (
def image_url(attachment, suffix):
    '''Return url of an image given size(@param suffix)
    e.g large, medium, small, or generate required thumbnail
    '''
    url = attachment.media_file.url
    if suffix == 'original':
        return url
    else:
        default_storage = get_storage_class()()
        fs = get_storage_class('django.core.files.storage.FileSystemStorage')()
        if suffix in settings.THUMB_CONF:
            size = settings.THUMB_CONF[suffix]['suffix']
            filename = attachment.media_file.name
            if default_storage.exists(filename):
                if default_storage.exists(get_path(filename, size)) and\
                        default_storage.size(get_path(filename, size)) > 0:
                    url = default_storage.url(
                        get_path(filename, size))
                else:
                    if default_storage.__class__ != fs.__class__:
                        resize(filename)
                    else:
                        resize_local_env(filename)
                    return image_url(attachment, suffix)
            else:
                return None
    return url
def image_url ( attachment , suffix ) : url = attachment . media_file . url if suffix == 'original' : return url else : default_storage = get_storage_class ( ) ( ) fs = get_storage_class ( 'django.core.files.storage.FileSystemStorage' ) ( ) if suffix in settings . THUMB_CONF : size = settings . THUMB_CONF [ suffix ] [ 'suffix' ] filename = attachment . media_file . name if default_storage . exists ( filename ) : if default_storage . exists ( get_path ( filename , size ) ) and default_storage . size ( get_path ( filename , size ) ) > 0 : url = default_storage . url ( get_path ( filename , size ) ) else : if default_storage . __class__ != fs . __class__ : resize ( filename ) else : resize_local_env ( filename ) return image_url ( attachment , suffix ) else : return None return url