开发者

How-to conform to a max/min width/height

I am using Carrierwave (https://github.com/jnicklas/carrierwave). I need to make sure images conform to a maximum/minimum height and width? Otherwise an error should display.

Should this be han开发者_运维知识库dled in the uploader class or in the model (possibly through a custom validation method)?


You can validate image width/height on the client side, but that does not guarantee anything, because it's easy to manipulate/circumvent.

For user friendliness: check on the client side and give a warning before uploading. For data integrity, check on the server side after upload.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜