mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-17 06:52:27 +01:00
Image max size is configutable, size by default is 2 megabytes
This commit is contained in:
parent
ba5e5752a4
commit
f1b749d5f2
@ -2,10 +2,12 @@
|
||||
|
||||
## next release
|
||||
|
||||
- Image max size is configutable, size by default is 2 megabytes
|
||||
- Allow add more picture for project step
|
||||
- Ability to use HTML in event's descriptions using a WYSIWYG editor
|
||||
- Fix a bug: statistics graphs were not showing
|
||||
- In the sign-up modal, the translation for 'i_accept_to_receive_information_from_the_fablab' was not loaded
|
||||
- [TODO DEPLOY] add `MAX_IMAGE_SIZE` environment variable in `application.yml` and docker env
|
||||
|
||||
## v2.4.1 2016 October 11
|
||||
|
||||
|
7
app/models/concerns/image_validator_concern.rb
Normal file
7
app/models/concerns/image_validator_concern.rb
Normal file
@ -0,0 +1,7 @@
|
||||
module ImageValidatorConcern
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
validates :attachment, file_size: { maximum: Rails.application.secrets.max_image_size ? Rails.application.secrets.max_image_size.to_i : 2.megabytes.to_i }
|
||||
end
|
||||
end
|
@ -1,5 +1,4 @@
|
||||
class EventImage < Asset
|
||||
include ImageValidatorConcern
|
||||
mount_uploader :attachment, EventImageUploader
|
||||
|
||||
validates :attachment, file_size: { maximum: 2.megabytes.to_i }
|
||||
end
|
||||
|
@ -1,4 +1,4 @@
|
||||
class PlanImage < Asset
|
||||
include ImageValidatorConcern
|
||||
mount_uploader :attachment, PlanImageUploader
|
||||
validates :attachment, file_size: { maximum: 2.megabytes.to_i }
|
||||
end
|
||||
|
@ -1,5 +1,4 @@
|
||||
class ProjectImage < Asset
|
||||
include ImageValidatorConcern
|
||||
mount_uploader :attachment, ProjectImageUploader
|
||||
|
||||
validates :attachment, file_size: { maximum: 2.megabytes.to_i }
|
||||
end
|
||||
|
@ -1,5 +1,4 @@
|
||||
class ProjectStepImage < Asset
|
||||
include ImageValidatorConcern
|
||||
mount_uploader :attachment, ProjectImageUploader
|
||||
|
||||
validates :attachment, file_size: { maximum: 2.megabytes.to_i }
|
||||
end
|
||||
|
@ -1,4 +1,4 @@
|
||||
class UserAvatar < Asset
|
||||
|
||||
include ImageValidatorConcern
|
||||
mount_uploader :attachment, ProfilImageUploader
|
||||
end
|
||||
|
@ -59,3 +59,6 @@ LOG_LEVEL: 'debug'
|
||||
|
||||
ALLOWED_EXTENSIONS: pdf ai eps cad math svg stl dxf dwg obj step iges igs 3dm 3dmf doc docx png ino scad fcad skp sldprt sldasm slddrw slddrt tex latex ps
|
||||
ALLOWED_MIME_TYPES: application/pdf application/postscript application/illustrator image/x-eps image/svg+xml application/sla application/dxf application/acad application/dwg application/octet-stream application/step application/iges model/iges x-world/x-3dmf application/ application/vnd.openxmlformats-officedocument.wordprocessingml.document image/png text/x-arduino text/plain application/scad application/vnd.sketchup.skp application/x-koan application/vnd-koan koan/x-skm application/vnd.koan application/x-tex application/x-latex
|
||||
|
||||
# 10485760 = 10 megabytes
|
||||
MAX_IMAGE_SIZE: 10485760
|
||||
|
@ -39,6 +39,7 @@ development:
|
||||
log_level: <%= ENV["LOG_LEVEL"] %>
|
||||
facebook_app_id: <%= ENV["FACEBOOK_APP_ID"] %>
|
||||
elaticsearch_host: <%= ENV["ELASTICSEARCH_HOST"] %>
|
||||
max_image_size: <%= ENV["MAX_IMAGE_SIZE"] %>
|
||||
|
||||
test:
|
||||
secret_key_base: 83daf5e7b80d990f037407bab78dff9904aaf3c195a50f84fa8695a22287e707dfbd9524b403b1dcf116ae1d8c06844c3d7ed942564e5b46be6ae3ead93a9d30
|
||||
@ -69,6 +70,7 @@ test:
|
||||
log_level: <%= ENV["LOG_LEVEL"] %>
|
||||
facebook_app_id: <%= ENV["FACEBOOK_APP_ID"] %>
|
||||
elaticsearch_host: localhost
|
||||
max_image_size: <%= ENV["MAX_IMAGE_SIZE"] %>
|
||||
|
||||
staging:
|
||||
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
|
||||
@ -104,6 +106,7 @@ staging:
|
||||
log_level: <%= ENV["LOG_LEVEL"] %>
|
||||
facebook_app_id: <%= ENV["FACEBOOK_APP_ID"] %>
|
||||
elaticsearch_host: <%= ENV["ELASTICSEARCH_HOST"] %>
|
||||
max_image_size: <%= ENV["MAX_IMAGE_SIZE"] %>
|
||||
|
||||
# Do not keep production secrets in the repository,
|
||||
# instead read values from the environment.
|
||||
@ -142,3 +145,4 @@ production:
|
||||
log_level: <%= ENV["LOG_LEVEL"] %>
|
||||
facebook_app_id: <%= ENV["FACEBOOK_APP_ID"] %>
|
||||
elaticsearch_host: <%= ENV["ELASTICSEARCH_HOST"] %>
|
||||
max_image_size: <%= ENV["MAX_IMAGE_SIZE"] %>
|
||||
|
@ -60,3 +60,6 @@ LOG_LEVEL=debug
|
||||
|
||||
ALLOWED_EXTENSIONS=pdf ai eps cad math svg stl dxf dwg obj step iges igs 3dm 3dmf doc docx png ino scad fcad skp sldprt sldasm slddrw slddrt tex latex ps
|
||||
ALLOWED_MIME_TYPES=application/pdf application/postscript application/illustrator image/x-eps image/svg+xml application/sla application/dxf application/acad application/dwg application/octet-stream application/step application/iges model/iges x-world/x-3dmf application/ application/vnd.openxmlformats-officedocument.wordprocessingml.document image/png text/x-arduino text/plain application/scad application/vnd.sketchup.skp application/x-koan application/vnd-koan koan/x-skm application/vnd.koan application/x-tex application/x-latex
|
||||
|
||||
# 10485760 = 10 megabytes
|
||||
MAX_IMAGE_SIZE=10485760
|
||||
|
Loading…
x
Reference in New Issue
Block a user