This plugin extends sfFileValidator to add verification of the minimum/maximum/exact height and width of an image sent by a form, verification of image aspect ratio and deactivation of the interlacing of a JPEG image

Developers

License

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Get it installed

Usage

Edit your validate.yml to add file validation:

fields:
picture:
file: True
sfExtendedFileValidator:
mime_types:
- 'image/jpeg'
- 'image/pjpeg'
mime_types_error: You must send a JPEG image
max_size: 1024000
max_size_error: You must send an image with a maximum weight of 1024000 bytes
# Options added by sfExtendedFileValidatorPlugin
min_width: 100
min_width_error: You must send an image with a minimum width of 100 pixels
max_width: 1000
max_width_error: You must send an image with a maximum width of 1000 pixels
min_height: 100
min_height_error: You must send an image with a minimum height of 100 pixels
max_height: 1000
max_height_error: You must send an image with a maximum height of 1000 pixels
aspect: 2
aspect_error: You must send an image with an aspect ratio of 2

You can use all the options proposed by sfFileValidator and add this new options: