Created
January 26, 2012 23:42
-
-
Save regedarek/1685881 to your computer and use it in GitHub Desktop.
CarrierWave
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: utf-8 | |
class FileUploader < CarrierWave::Uploader::Base | |
include CarrierWave::RMagick | |
storage :file | |
def store_dir | |
"photos/#{model.attachable_id}" | |
end | |
process :resize_to_limit => [500, 500] | |
process :convert => 'png' | |
version :medium do | |
process :resize_to_limit => [250, 250] | |
process :convert => 'png' | |
def full_filename (for_file = model.file) | |
"thumb_#{model.id}_medium.png" | |
end | |
end | |
version :small do | |
process :resize_to_limit => [50, 50] | |
process :convert => 'png' | |
def full_filename (for_file = model.file) | |
"thumb_#{model.id}_small.png" | |
end | |
end | |
def filename | |
"#{model.id}_original.png" if original_filename | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#title | |
%h1 | |
= @ad.title | |
#ad_content | |
%b Treść ogłoszenia: | |
= @ad.ad_content | |
%br | |
- if @ad.photos.present? | |
- @ad.photos.each do |p| | |
#photos | |
= image_tag("../../photos/#{@ad.id}/thumb_#{p.id}_small.png") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment