Skip to content

Instantly share code, notes, and snippets.

@patrick99e99
Created September 18, 2009 18:14
Show Gist options
  • Save patrick99e99/189204 to your computer and use it in GitHub Desktop.
Save patrick99e99/189204 to your computer and use it in GitHub Desktop.
def file_path
# -- I changed this line from: --
# "#{directory_path}/#{id}.#{self.class.image_storage_format}"
"#{directory_path}/#{id}.#{self.server_format}"
end
def pre_save
if @uploaded_image
# perform preprocessing
perform_preprocess_operation
# Convert to storage format
# -- I removed this line: --
# @uploaded_image.format = self.class.image_storage_format.to_s.upcase
# -- and replaced it with: --
@uploaded_image.format = self.server_format
# Write image data to the DB field
if self.class.db_store?
self.image_file_data = @uploaded_image.to_blob
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment