Recreate versions and reprocess them. This can be used to recreate versions if their parameters somehow have changed.
# File lib/carrierwave/uploader/versions.rb, line 114 def recreate_versions! with_callbacks(:recreate_versions, file) do versions.each { |name, v| v.store!(file) } end end
When given a version name as a parameter, will return the url for that version This also works with nested versions.
my_uploader.url # => /path/to/my/uploader.gif my_uploader.url(:thumb) # => /path/to/my/thumb_uploader.gif my_uploader.url(:thumb, :small) # => /path/to/my/thumb_small_uploader.gif
any number of versions
the location where this file is accessible via a url
# File lib/carrierwave/uploader/versions.rb, line 100 def url(*args) if(args.first) raise ArgumentError, "Version #{args.first} doesn't exist!" if versions[args.first.to_sym].nil? # recursively proxy to version versions[args.first.to_sym].url(*args[1..-1]) else super() end end
the name of this version of the uploader
# File lib/carrierwave/uploader/versions.rb, line 78 def version_name self.class.version_names.join('_').to_sym unless self.class.version_names.blank? end
Returns a hash mapping the name of each version of the uploader to an instance of it
a list of uploader instances
# File lib/carrierwave/uploader/versions.rb, line 64 def versions return @versions if @versions @versions = {} self.class.versions.each do |name, klass| @versions[name] = klass.new(model, mounted_as) end @versions end