Symfony 4 was released on November 30th.
Update now to the best Symfony ever!

WARNING: You are browsing the documentation for Symfony 2.0 which is not maintained anymore. Consider upgrading your projects to Symfony 4.0.

Image

Image

The Image constraint works exactly like the File constraint, except that its mimeTypes and mimeTypesMessage options are automatically setup to work for image files specifically.

See the File constraint for the bulk of the documentation on this constraint.

Options

This constraint shares all of its options with the File constraint. It does, however, modify two of the default option values:

mimeTypes

type: array or string default: an array of jpg, gif and png image mime types

You can find a list of existing image mime types on the IANA website

mimeTypesMessage

type: string default: This file is not a valid image

This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.