Sha256: 60fde91875e6e435f24bcda6cff3b1fcb1d50f102e74180bf6f0c0ac201ceecc

Contents?: true

Size: 1.61 KB

Versions: 1

Compression:

Stored size: 1.61 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
     attr_accessible :attachment_content_type,:attachment_file_name,:attachment_file_size,:attachment
     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

1 entries across 1 versions & 1 rubygems

Version Path
spud_media-0.8.3 app/models/spud_media.rb