workdir -- directory path for storing converted image files
new_size -- 2-tuple size for the resized image
"""
+ config = mgg.global_config['media_type:mediagoblin.media_types.image']
+
try:
resized = Image.open(filename)
except IOError:
raise BadMediaFail()
resized = exif_fix_image_orientation(resized, exif_tags) # Fix orientation
- filter_config = \
- mgg.global_config['media_type:mediagoblin.media_types.image']\
- ['resize_filter']
-
+ filter_config = config['resize_filter']
try:
resize_filter = PIL_FILTERS[filter_config.upper()]
except KeyError:
# Copy the new file to the conversion subdir, then remotely.
tmp_resized_filename = os.path.join(workdir, new_path[-1])
with file(tmp_resized_filename, 'w') as resized_file:
- resized.save(resized_file,
- quality=mgg.global_config['media_type:mediagoblin.media_types.image']\
- ['quality'])
+ resized.save(resized_file, quality=config['quality'])
mgg.public_store.copy_local_to_storage(tmp_resized_filename, new_path)