JPEG header has width and height in pixels, I want to validate using these values (maximum 19200x19200) Can I do this with a paperclip? ?
Or maybe I can use it when I upload the file. Uploadify
If it's just jeopardizing you, you can read Exif data in some way: You can trigger it on one of the uploadeef callbacks (like: selection):
Otherwise, if you can not read EXIF, you will need to upload it, implement it, And if it is more than just need to throw it away and send an error back.
From the paperclip readme (https://github.com/thoughtbot/paperclip/blob/master/README.md):
before and after the post processing stage , The paperclip calls back to the model with some callback, allowing the model to change or cancel the processing phase. Callback before_past_process and after_post_process
Anyway, you can use the paperclip to fill the dimensions:
dimension = paperclip :: geometry.from_file ( Original_file)
If the file is too large, the paperclip will also resize for you, so if your users upload a large file then it does not matter:
< Code> has_attached_file: avatar, style = gt; {: Basic = & gt; ["19200x19200" ;:: jpg]}
Comments
Post a Comment