add image cropping support

This commit is contained in:
Albert Yi
2018-05-16 17:13:36 -07:00
parent df73c682db
commit 64446d49e1
20 changed files with 150 additions and 471 deletions

View File

@@ -173,6 +173,10 @@ class Post < ApplicationRecord
storage_manager.file_path(md5, file_ext, :preview)
end
def crop_file_url
storage_manager.file_url(self, :crop)
end
def open_graph_image_url
if is_image?
if has_large?

View File

@@ -92,6 +92,8 @@ class User < ApplicationRecord
has_many :post_approvals, :dependent => :destroy
has_many :post_disapprovals, :dependent => :destroy
has_many :post_votes
has_many :post_archives
has_many :note_versions
has_many :bans, -> {order("bans.id desc")}
has_one :recent_ban, -> {order("bans.id desc")}, :class_name => "Ban"