def pre_save(self, model_instance, add):
file = getattr(model_instance, self.attname)<EOL>if file and not file._committed:<EOL><INDENT>file.name = self._clean_file_name(model_instance, file.name)<EOL>file.file = self._resize_image(model_instance, file)<EOL>file.save(file.name, file, save=False)<EOL><DEDENT>return file<EOL>
Resizes, commits image to storage, and returns field's value just before saving.