Sha256: a3cb01e3fa8a5da140ce9532e69673c46b6110e0b5e78408527153858ea4be15

Contents?: true

Size: 1.51 KB

Versions: 4

Compression:

Stored size: 1.51 KB

Contents

class SpudMedia < ActiveRecord::Base
	has_attached_file :attachment,
     :storage => Spud::Media.paperclip_storage,
     :s3_credentials => Spud::Media.s3_credentials,
     :path => Spud::Media.storage_path,
     :url => Spud::Media.storage_url

     def image_from_type
     	if self.attachment_content_type.blank?
     		return "spud/admin/files_thumbs/dat_thumb.png"
     	end

     	if self.attachment_content_type.match(/jpeg|jpg/)
     		return "spud/admin/files_thumbs/jpg_thumb.png"
     	end

     	

     	if self.attachment_content_type.match(/png/)
     		return "spud/admin/files_thumbs/png_thumb.png"
     	end

     	if self.attachment_content_type.match(/zip|tar|tar\.gz|gz/)
     		return "spud/admin/files_thumbs/zip_thumb.png"
     	end

     	if self.attachment_content_type.match(/xls|xlsx/)
     		return "spud/admin/files_thumbs/xls_thumb.png"
     	end
     	if self.attachment_content_type.match(/doc|docx/)
     		return "spud/admin/files_thumbs/doc_thumb.png"
     	end
     	if self.attachment_content_type.match(/ppt|pptx/)
     		return "spud/admin/files_thumbs/ppt_thumb.png"
     	end
     	if self.attachment_content_type.match(/txt|text/)
     		return "spud/admin/files_thumbs/txt_thumb.png"
     	end
     	if self.attachment_content_type.match(/pdf|ps/)
     		return "spud/admin/files_thumbs/pdf_thumb.png"
     	end
     	if self.attachment_content_type.match(/mp3|wav|aac/)
     		return "spud/admin/files_thumbs/mp3_thumb.png"
     	end

     	return "spud/admin/files_thumbs/dat_thumb.png"
     end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
spud_media-0.8.2 app/models/spud_media.rb
spud_media-0.8.1 app/models/spud_media.rb
spud_media-0.8.0 app/models/spud_media.rb
spud_media-0.4.1 app/models/spud_media.rb