Commit bdfeebda by Prem Sichanugrist

Some style change

parent 5ffcc855
......@@ -11,29 +11,29 @@ module Paperclip
def self.default_options
@default_options ||= {
:url => "/system/:attachment/:id/:style/:filename",
:path => ":rails_root/public:url",
:styles => {},
:convert_options => {},
:default_style => :original,
:default_url => "/:attachment/:style/missing.png",
:hash_data => ":class/:attachment/:id/:style/:updated_at",
:hash_digest => "SHA1",
:interpolator => Paperclip::Interpolations,
:only_process => [],
:path => ":rails_root/public:url",
:preserve_files => false,
:processors => [:thumbnail],
:convert_options => {},
:source_file_options => {},
:default_url => "/:attachment/:style/missing.png",
:default_style => :original,
:storage => :filesystem,
:styles => {},
:url => "/system/:attachment/:id/:style/:filename",
:url_generator => Paperclip::UrlGenerator
:use_default_time_zone => true,
:use_timestamp => true,
:whiny => Paperclip.options[:whiny] || Paperclip.options[:whiny_thumbnails],
:use_default_time_zone => true,
:hash_digest => "SHA1",
:hash_data => ":class/:attachment/:id/:style/:updated_at",
:preserve_files => false,
:interpolator => Paperclip::Interpolations,
:url_generator => Paperclip::UrlGenerator
}
end
attr_reader :name, :instance, :default_style, :convert_options, :queued_for_write, :whiny, :options, :interpolator
attr_reader :source_file_options, :whiny
attr_reader :name, :instance, :default_style, :convert_options, :queued_for_write, :whiny,
:options, :interpolator, :source_file_options, :whiny
attr_accessor :post_processing
# Creates an Attachment object. +name+ is the name of the attachment,
......
......@@ -5,7 +5,6 @@ module Paperclip
# to the +File+ class. Useful for testing.
# user.avatar = File.new("test/test_avatar.jpg")
module Upfile
# Infer the MIME-type of the file from the extension.
def content_type
types = MIME::Types.type_for(self.original_filename)
......@@ -23,7 +22,7 @@ module Paperclip
end
def type_from_file_command
# On BSDs, `file` doesn't give a result code of 1 if the file doesn't exist.
# On BSDs, `file` doesn't give a result code of 1 if the file doesn't exist.
type = (self.original_filename.match(/\.(\w+)$/)[1] rescue "octet-stream").downcase
mime_type = (Paperclip.run("file", "-b --mime :file", :file => self.path).split(/[:;]\s+/)[0] rescue "application/x-#{type}")
mime_type = "application/x-#{type}" if mime_type.match(/\(.*?\)/)
......@@ -45,12 +44,15 @@ end
if defined? StringIO
class StringIO
attr_accessor :original_filename, :content_type, :fingerprint
def original_filename
@original_filename ||= "stringio.txt"
end
def content_type
@content_type ||= "text/plain"
end
def fingerprint
@fingerprint ||= Digest::MD5.hexdigest(self.string)
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment