diff --git a/app/views/posts/attributes/_image.haml b/app/views/posts/attributes/_image.haml index f4d9bb3d..84fe56fd 100644 --- a/app/views/posts/attributes/_image.haml +++ b/app/views/posts/attributes/_image.haml @@ -22,7 +22,7 @@ = file_field(*field_name_for(base, attribute, :path), **field_options(attribute, metadata, required: (metadata.required && !metadata.path?)), class: "custom-file-input #{invalid(post, attribute)}", - accept: 'image/*', data: { preview: "#{attribute}-preview" }) + accept: ActiveStorage.web_image_content_types.join(','), data: { preview: "#{attribute}-preview" }) = label_tag "#{base}_#{attribute}_path", post_label_t(attribute, :path, post: post), class: 'custom-file-label' = render 'posts/attribute_feedback', diff --git a/config/application.rb b/config/application.rb index e1388d15..173bfc19 100644 --- a/config/application.rb +++ b/config/application.rb @@ -37,6 +37,7 @@ module Sutty .rescue_responses['Pundit::NotAuthorizedError'] = :forbidden config.active_storage.variant_processor = :vips + config.active_storage.web_image_content_types << 'image/webp' # Que config.action_mailer.deliver_later_queue_name = :default diff --git a/config/locales/en.yml b/config/locales/en.yml index f0818edb..a6e4384c 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -52,7 +52,7 @@ en: cant_be_empty: 'This field cannot be empty' image: site_invalid: 'The image cannot be stored if the site configuration is not valid' - not_an_image: 'Not an image' + not_an_image: 'Not a web image. Accepted formats: PNG, JPEG, GIF, WEBP' path_required: 'Missing image for upload' no_file_for_description: "Description with no associated image" attachment_missing: "I couldn't save the image :(" diff --git a/config/locales/es.yml b/config/locales/es.yml index dea62bfe..5354656a 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -52,7 +52,7 @@ es: cant_be_empty: 'El campo no puede estar vacío' image: site_invalid: 'La imagen no se puede almacenar si la configuración del sitio no es válida' - not_an_image: 'No es una imagen' + not_an_image: 'No es una imagen en formato web. Formatos aceptados: PNG, JPEG, GIF, WEBP' path_required: 'Se necesita una imagen' no_file_for_description: 'Se envió una descripción sin imagen asociada' attachment_missing: 'no pude guardar el archivo :('