def save_resized_photo(background_image_file, event_id, speaker_id, size, image_sizes): """ Save the resized version of the background image :param speaker_id: :param background_image_file: :param event_id: :param size: :param image_sizes: :return: """ basewidth = image_sizes.full_width height_size = image_sizes.full_height if size == 'small': basewidth = image_sizes.thumbnail_width height_size = image_sizes.thumbnail_height elif size == 'thumbnail': basewidth = image_sizes.full_width height_size = image_sizes.full_height elif size == 'icon': basewidth = image_sizes.icon_width height_size = image_sizes.icon_height upload_path = UPLOAD_PATHS['speakers'][size].format( event_id=int(event_id), id=int(speaker_id) ) if basewidth != height_size: if height_size > basewidth: basewidth = height_size else: height_size = basewidth return save_resized_image(background_image_file, basewidth, 'off', height_size, upload_path)
def save_resized_photo(background_image_file, event_id, speaker_id, size, image_sizes): """ Save the resized version of the background image :param speaker_id: :param background_image_file: :param event_id: :param size: :param image_sizes: :return: """ basewidth = image_sizes.full_width aspect = image_sizes.full_aspect height_size = image_sizes.full_height if size == 'small': aspect = image_sizes.full_aspect basewidth = image_sizes.full_width height_size = image_sizes.full_height elif size == 'thumbnail': aspect = image_sizes.full_aspect basewidth = image_sizes.thumbnail_width height_size = image_sizes.thumbnail_height elif size == 'icon': aspect = image_sizes.icon_aspect basewidth = image_sizes.icon_width height_size = image_sizes.icon_height upload_path = UPLOAD_PATHS['speakers'][size].format(event_id=int(event_id), id=int(speaker_id)) return save_resized_image(background_image_file, basewidth, aspect, height_size, upload_path)
def save_resized_background(background_image_file, event_id, size, image_sizes): """ Save the resized version of the background image :param background_image_file: :param event_id: :param size: :param image_sizes: :return: """ basewidth = image_sizes.full_width aspect = image_sizes.full_aspect height_size = image_sizes.full_height if size == 'large': aspect = image_sizes.full_aspect basewidth = image_sizes.full_width height_size = image_sizes.full_height elif size == 'thumbnail': aspect = image_sizes.full_aspect basewidth = image_sizes.thumbnail_width height_size = image_sizes.thumbnail_height elif size == 'icon': aspect = image_sizes.icon_aspect basewidth = image_sizes.icon_width height_size = image_sizes.icon_height upload_path = UPLOAD_PATHS['event'][size].format( event_id=int(event_id) ) return save_resized_image(background_image_file, basewidth, aspect, height_size, upload_path)