You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Marten presently supports file model fields and schema fields, which respectively allow (i) to attach files to model records and (ii) to process / validate uploaded files as part of schemas. Another common need of web applications is to handle image uploading and validation. Ideally, it should be possible to attach images to models using an image model field:
classBlogPost < Marten::Model
field :id, :big_int, primary_key:true, auto:true
field :title, :string, max_size:100
field :header_image, :image# uses the default media file storage
field :other_image, :image, storage: my_custome_storage
end
It should also be possible to define image fields as part of schemas:
classBlogPostSchema < Marten::Model
field :title, :string, max_size:100
field :header_image, :imageend
This comes with an additional set of requirements: it becomes necessary to validate the type of files being attached to model records or processed by schemas in order to ensure that only image files are allowed. Non-image files should result in validation errors. Validating that a file is indeed an image could be achieved by leveraging some external image processing shards; and a few candidates could be considered:
Regardless of the chosen shard, this shouldn't become a "hard" dependency of Marten: Marten should work as expected even if the chosen shard is not installed, but using image model / schema fields wouldn't not be possible.
The text was updated successfully, but these errors were encountered:
Description
Marten presently supports
file
model fields and schema fields, which respectively allow (i) to attach files to model records and (ii) to process / validate uploaded files as part of schemas. Another common need of web applications is to handle image uploading and validation. Ideally, it should be possible to attach images to models using animage
model field:It should also be possible to define
image
fields as part of schemas:This comes with an additional set of requirements: it becomes necessary to validate the type of files being attached to model records or processed by schemas in order to ensure that only image files are allowed. Non-image files should result in validation errors. Validating that a file is indeed an image could be achieved by leveraging some external image processing shards; and a few candidates could be considered:
Regardless of the chosen shard, this shouldn't become a "hard" dependency of Marten: Marten should work as expected even if the chosen shard is not installed, but using
image
model / schema fields wouldn't not be possible.The text was updated successfully, but these errors were encountered: