maintain current directory structure for images
This commit is contained in:
@@ -90,12 +90,12 @@ class Post < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def file_path
|
||||
"#{Rails.root}/public/data/original/#{file_path_prefix}#{md5}.#{file_ext}"
|
||||
"#{Rails.root}/public/data/#{file_path_prefix}#{md5}.#{file_ext}"
|
||||
end
|
||||
|
||||
def large_file_path
|
||||
if has_large?
|
||||
"#{Rails.root}/public/data/large/#{file_path_prefix}#{md5}.jpg"
|
||||
"#{Rails.root}/public/data/sample/#{file_path_prefix}#{Danbooru.config.large_image_prefix}#{md5}.jpg"
|
||||
else
|
||||
file_path
|
||||
end
|
||||
@@ -118,12 +118,12 @@ class Post < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def file_url
|
||||
"/data/original/#{file_path_prefix}#{md5}.#{file_ext}"
|
||||
"/data/#{file_path_prefix}#{md5}.#{file_ext}"
|
||||
end
|
||||
|
||||
def large_file_url
|
||||
if has_large?
|
||||
"/data/large/#{file_path_prefix}#{md5}.jpg"
|
||||
"/data/sample/#{file_path_prefix}#{Danbooru.config.large_image_prefix}#{md5}.jpg"
|
||||
else
|
||||
file_url
|
||||
end
|
||||
|
||||
@@ -209,7 +209,7 @@ class Upload < ActiveRecord::Base
|
||||
module FilePathMethods
|
||||
def md5_file_path
|
||||
prefix = Rails.env == "test" ? "test." : ""
|
||||
"#{Rails.root}/public/data/original/#{prefix}#{md5}.#{file_ext}"
|
||||
"#{Rails.root}/public/data/#{prefix}#{md5}.#{file_ext}"
|
||||
end
|
||||
|
||||
def resized_file_path_for(width)
|
||||
@@ -220,7 +220,7 @@ class Upload < ActiveRecord::Base
|
||||
"#{Rails.root}/public/data/preview/#{prefix}#{md5}.jpg"
|
||||
|
||||
when Danbooru.config.large_image_width
|
||||
"#{Rails.root}/public/data/large/#{prefix}#{md5}.jpg"
|
||||
"#{Rails.root}/public/data/sample/#{prefix}#{md5}.jpg"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user