The website I am working on is being redesigned and so our user images need to be changed. Currently, the website uses a carrier-supported camcorder to process all images and videos, and each image has a source file with a unique file name based on the following:
def filename if original_filename if model && model.read_attribute(:user_image).present? model.read_attribute(:user_image) else @name ||= "#{secure_token}.#{file.extension}" if original_filename.present? end end end
and secure_token are generated
def secure_token var = :"@#{mounted_as}_secure_token" model.instance_variable_get(var) or model.instance_variable_set(var, SecureRandom.uuid) end
The task created for this:
#
The problem is that when creating new images, the files are saved under the new file name, and not by the name specified in the image downloader, so the website cannot find them. The following is an example of how images are saved.
How it should be:
Source file: fdk392ks93_39ei.png
thumbnail version: thumb_fdk392ks93_39ei.png
Like this:
Source file: fdk392ks93_39ei.png
thumbnail version: thumb_fajeilkadifej_jakdjfi.png
Any help would be greatly appreciated.
Additional Information:
Model: User
Uploader: user_image (this is also the name of the column in which the folder / file name is stored)
ruby-on-rails-3 amazon-s3 carrierwave
CorreyS
source share