@@ -24,6 +24,7 @@ of the documentation on this constraint.
24
24
| | - `allowSquare `_ |
25
25
| | - `allowLandscape `_ |
26
26
| | - `allowPortrait `_ |
27
+ | | - `detectCorrupted `_ |
27
28
| | - `mimeTypesMessage `_ |
28
29
| | - `sizeNotDetectedMessage `_ |
29
30
| | - `maxWidthMessage `_ |
@@ -35,6 +36,7 @@ of the documentation on this constraint.
35
36
| | - `allowSquareMessage `_ |
36
37
| | - `allowLandscapeMessage `_ |
37
38
| | - `allowPortraitMessage `_ |
39
+ | | - `corruptedMessage `_ |
38
40
| | - See :doc: `File </reference/constraints/File >` for inherited options |
39
41
+----------------+-----------------------------------------------------------------------+
40
42
| Class | :class: `Symfony\\ Component\\ Validator\\ Constraints\\ Image ` |
@@ -311,6 +313,18 @@ allowPortrait
311
313
312
314
If this option is false, the image cannot be portrait oriented.
313
315
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
+
314
328
sizeNotDetectedMessage
315
329
~~~~~~~~~~~~~~~~~~~~~~
316
330
@@ -392,4 +406,16 @@ Portrait oriented images are not allowed``
392
406
393
407
The error message if the image is portrait oriented and you set `allowPortrait `_ to ``false ``.
394
408
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
+
395
420
.. _`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