Skip to content

Commit 6b1abf7

Browse files
committed
feature #6433 Documented the detectCorrupted and corruptedMessage options (javiereguiluz)
This PR was squashed before being merged into the master branch (closes #6433). Discussion ---------- Documented the detectCorrupted and corruptedMessage options | Q | A | ------------- | --- | Doc fix? | no | New docs? | yes | Applies to | master (3.1+) | Fixed tickets | symfony/symfony#17458 Commits ------- 2140822 Documented the detectCorrupted and corruptedMessage options
2 parents fe177cc + 2140822 commit 6b1abf7

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

reference/constraints/Image.rst

+26
Original file line numberDiff line numberDiff line change
@@ -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

312314
If 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+
314328
sizeNotDetectedMessage
315329
~~~~~~~~~~~~~~~~~~~~~~
316330

@@ -392,4 +406,16 @@ Portrait oriented images are not allowed``
392406

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

Comments
 (0)