5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-16 15:31:43 +00:00
panel/app/models/metadata_image.rb

20 lines
362 B
Ruby

# frozen_string_literal: true
# Define un campo de imagen
class MetadataImage < MetadataFile
def validate
super
errors << I18n.t('metadata.image.not_an_image') unless image?
errors.compact!
errors.empty?
end
# Determina si es una imagen
def image?
return true unless file
filemagic.file(file).starts_with? 'image/'
end
end