diff --git a/reference/constraints/Image.rst b/reference/constraints/Image.rst index 0720326c0a3..a326174a970 100644 --- a/reference/constraints/Image.rst +++ b/reference/constraints/Image.rst @@ -24,6 +24,7 @@ of the documentation on this constraint. | | - `allowSquare`_ | | | - `allowLandscape`_ | | | - `allowPortrait`_ | +| | - `detectCorrupted`_ | | | - `mimeTypesMessage`_ | | | - `sizeNotDetectedMessage`_ | | | - `maxWidthMessage`_ | @@ -35,6 +36,7 @@ of the documentation on this constraint. | | - `allowSquareMessage`_ | | | - `allowLandscapeMessage`_ | | | - `allowPortraitMessage`_ | +| | - `corruptedMessage`_ | | | - See :doc:`File ` for inherited options | +----------------+-----------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Validator\\Constraints\\Image` | @@ -311,6 +313,18 @@ allowPortrait If this option is false, the image cannot be portrait oriented. +detectCorrupted +~~~~~~~~~~~~~~~ + +.. versionadded:: 3.1 + The ``detectCorrupted`` option was introduced in Symfony 3.1. + +**type**: ``boolean`` **default**: ``false`` + +If this option is true, the image contents are validated to ensure that the +image is not corrupted. This validation is done with PHP's :phpfunction:`imagecreatefromstring` +function, which requires the `PHP GD extension`_ to be enabled. + sizeNotDetectedMessage ~~~~~~~~~~~~~~~~~~~~~~ @@ -392,4 +406,16 @@ Portrait oriented images are not allowed`` The error message if the image is portrait oriented and you set `allowPortrait`_ to ``false``. +corruptedMessage +~~~~~~~~~~~~~~~~ + +.. versionadded:: 3.1 + The ``corruptedMessage`` option was introduced in Symfony 3.1. + +**type**: ``string`` **default**: ``The image file is corrupted.`` + +The error message when the `detectCorrupted`_ option is enabled and the image +is corrupted. + .. _`IANA website`: http://www.iana.org/assignments/media-types/image/index.html +.. _`PHP GD extension`: http://php.net/manual/en/book.image.php