Sorry, if this is a duplicate but my previous response was not posted
for some reason so I'm posting again
Firstly a big thanks to Harmon. This is what I was looking for.
I can't seem to make it work quite the way I want it to though
My model
has_attached_file :icon, :default_style => :thumb,
:styles => {:thumb => ["32x32>"]},
:storage => :Ftp,
:url => "/system/
catalogue/:id/:style/:basename.:extension",
:path => "/httpdocs/#{SiteDetail.get_url}/system/
catalogue/:id/:style/:basebname.:extension"
before_post_process :set_icon_name
protected
def set_icon_name
unless self.icon_file_name.empty?
self.icon_file_name = "catalogue_#{
self.name}_icon"
end
end
This will generate the correct url so that image tags point to the
location and file name that I want them to with the amended file name
but the uploaded image still has the original file name so it seems
that the :path => ... does not take the new file name into account.
Maybe it's a timing issue and the before_post_process is too late in
the scheme of things to affect the path so any ideas on what event/
callback would work?
I've tried before_save event on the model but that had the same
effect.