Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2140822

Browse filesBrowse files
javiereguiluzwouterj
authored andcommitted
Documented the detectCorrupted and corruptedMessage options
1 parent 10ea5e9 commit 2140822
Copy full SHA for 2140822

File tree

Expand file treeCollapse file tree

1 file changed

+26
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+26
-0
lines changed

‎reference/constraints/Image.rst

Copy file name to clipboardExpand all lines: reference/constraints/Image.rst
+26Lines changed: 26 additions & 0 deletions
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.