media assets: add dynamically-generated thumbnails (owner-only).
Add ability to dynamically generate thumbnails with: * https://danbooru.donmai.us/media_assets/6961761.jpg?width=180&height=180 This is currently restricted to the Owner-level user because it's slow.
This commit is contained in:
@@ -304,6 +304,11 @@ class MediaAsset < ApplicationRecord
|
||||
end
|
||||
end
|
||||
|
||||
# @return [Mime::Type] The file's MIME type.
|
||||
def mime_type
|
||||
Mime::Type.lookup_by_extension(file_ext)
|
||||
end
|
||||
|
||||
def file=(file_or_path)
|
||||
media_file = file_or_path.is_a?(MediaFile) ? file_or_path : MediaFile.open(file_or_path)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user