@@ -24,6 +24,7 @@ of the documentation on this constraint.
2424| | - `allowSquare `_ |
2525| | - `allowLandscape `_ |
2626| | - `allowPortrait `_ |
27+ | | - `detectCorrupted `_ |
2728| | - `mimeTypesMessage `_ |
2829| | - `sizeNotDetectedMessage `_ |
2930| | - `maxWidthMessage `_ |
@@ -35,6 +36,7 @@ of the documentation on this constraint.
3536| | - `allowSquareMessage `_ |
3637| | - `allowLandscapeMessage `_ |
3738| | - `allowPortraitMessage `_ |
39+ | | - `corruptedMessage `_ |
3840| | - See :doc: `File </reference/constraints/File >` for inherited options |
3941+----------------+-----------------------------------------------------------------------+
4042| Class | :class: `Symfony\\ Component\\ Validator\\ Constraints\\ Image ` |
@@ -311,6 +313,18 @@ allowPortrait
311313
312314If this option is false, the image cannot be portrait oriented.
313315
316+ detectCorrupted
317+ ~~~~~~~~~~~~~~~
318+
319+ .. versionadded :: 3.1
320+ The ``detectCorrupted `` option was introduced in Symfony 3.1.
321+
322+ **type **: ``boolean `` **default **: ``false ``
323+
324+ If this option is true, the image contents are validated to ensure that the
325+ image is not corrupted. This validation is done with PHP's :phpfunction: `imagecreatefromstring `
326+ function, which requires the `PHP GD extension `_ to be enabled.
327+
314328sizeNotDetectedMessage
315329~~~~~~~~~~~~~~~~~~~~~~
316330
@@ -392,4 +406,16 @@ Portrait oriented images are not allowed``
392406
393407The error message if the image is portrait oriented and you set `allowPortrait `_ to ``false ``.
394408
409+ corruptedMessage
410+ ~~~~~~~~~~~~~~~~
411+
412+ .. versionadded :: 3.1
413+ The ``corruptedMessage `` option was introduced in Symfony 3.1.
414+
415+ **type **: ``string `` **default **: ``The image file is corrupted. ``
416+
417+ The error message when the `detectCorrupted `_ option is enabled and the image
418+ is corrupted.
419+
395420.. _`IANA website` : http://www.iana.org/assignments/media-types/image/index.html
421+ .. _`PHP GD extension` : http://php.net/manual/en/book.image.php
0 commit comments