sfExtendedFileValidatorPlugin - 0.1.0

Extended file validator

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to the Plugins Home

Signin


Forgot your password?
Create an account

Tools

Stats

advanced search
Information Readme Releases Changelog Contribute
Show source

sfExtendedFileValidatorPlugin

Introduction

This plugin extends sfFileValidator to add verification of the height and width of an image sent by a form.

Features

  • check minimum/maximum width/height/weight of an image sent by a form

Get it installed

  • Go to your project's root

  • Install the plugin:

    ./symfony plugin-install http://plugins.symfony-project.com/sfExtendedFileValidatorPlugin

  • Clear cache:

    ./symfony cc

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
      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

License and credits

This plugin has been developed by Vincent Lemaire and is licensed under the MIT license.

Todo

  • unit-tests

Changelog

  • version 0.1 - 2008-08-18
    • First public release