Sha256: 22b778cc21d50116de1844f07c9cfa02972269c2cdd42084c579ad6fda7f8a01
Contents?: true
Size: 1.01 KB
Versions: 31
Compression:
Stored size: 1.01 KB
Contents
# frozen_string_literal: true module Decidim # This class deals with uploading hero images to ParticipatoryProcesses. class ImageUploader < ApplicationUploader def validable_dimensions true end def content_type_allowlist extension_allowlist.map { |ext| "image/#{ext}" } end # Fetches info about different variants, their processors and dimensions def dimensions_info return if variants.blank? variants.transform_values do |variant| { processor: variant.keys.first, dimensions: variant.values.first } end end # Add a white list of extensions which are allowed to be uploaded. # For images you might use something like this: def extension_allowlist Decidim.organization_settings(model).upload_allowed_file_extensions_image end def max_image_height_or_width 3840 end private def maximum_upload_size Decidim.organization_settings(model).upload_maximum_file_size end end end
Version data entries
31 entries across 31 versions & 1 rubygems