我正在上传一个我正在制作许多版本的图片,我希望能够将每个版本放在不同的文件夹中。例如:
class ItunesArtworkUploader < CarrierWave::Uploader::Base
DIMENSIONS = [1024, 1024]
{
:iphone_small_29x29 => { size: [29, 29], filename: "icon-small.png" },
:iphone_57x57 => { size: [57, 57], filename: "icon.png" }
}
# resize
def filename
"iTunesArtwork.png"
end
end
最初的ItunesArtwork.png正在上传/ foo / itunes_artwork / iTunesArtwork.png。现在,对于每个版本,我希望它们位于“foo”下面的自己的文件夹中,如下所示:
uploads/foo/itunes_artwork/iTunesArtwork.png
uploads/foo/itunes_artwork/icon-small.png
uploads/foo/itunes_artwork/icon.png
我试过
:iphone_small_29x29 => { size: [29, 29], filename: "/icon-small/icon-small.png"},
但是这给了我一个结果文件路径:
uploads/foo/itunes_artwork/icon-small/icon-small.png
任何建议都会很棒,谢谢!