ruby on rails - How do you validate attachment_fu's image width and height? -


I want to be able to validate the image that there really is definite or fixed height, or if it is a square. When I try to reach image_size , width , or height in the verification block of the model has_attachment >

itemprop = "text">

Yes, you need to hack a bit to work on it, but not so much. Optimize with Attachment_fu's own image processor:

  Validate: validate_image_size private def validate_image_size w, h = width, height or image with w or h. Img | W, h = img.columns, img.rows end-end errors.add (width, "should be less than 250px") if w> 250 errors.add (: height, "should be less than 250px") if H & gt; 250 End End  

Comments