Updated PreviewCard, FetchLinkCardService, FetchOEmbedService

• Updated:
- PreviewCard, FetchLinkCardService, FetchOEmbedService to work better
This commit is contained in:
mgabdev
2020-07-22 13:51:08 -05:00
parent 8f4be991a0
commit 7aa7b66374
3 changed files with 8 additions and 4 deletions

View File

@@ -26,7 +26,7 @@
class PreviewCard < ApplicationRecord
IMAGE_MIME_TYPES = ['image/jpeg', 'image/png', 'image/gif', 'image/webp'].freeze
LIMIT = 1.megabytes
LIMIT = 4.megabytes
self.inheritance_column = false
@@ -45,6 +45,10 @@ class PreviewCard < ApplicationRecord
before_save :extract_dimensions, if: :link?
def missing_image?
width.present? && height.present? && image_file_name.blank?
end
def save_with_optional_image!
save!
rescue ActiveRecord::RecordInvalid