Skip to content

Commit

Permalink
feature #6433 Documented the detectCorrupted and corruptedMessage opt…
Browse files Browse the repository at this point in the history
…ions (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
  • Loading branch information
wouterj committed May 5, 2016
2 parents fe177cc + 2140822 commit 6b1abf7
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions reference/constraints/Image.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ of the documentation on this constraint.
| | - `allowSquare`_ |
| | - `allowLandscape`_ |
| | - `allowPortrait`_ |
| | - `detectCorrupted`_ |
| | - `mimeTypesMessage`_ |
| | - `sizeNotDetectedMessage`_ |
| | - `maxWidthMessage`_ |
Expand All @@ -35,6 +36,7 @@ of the documentation on this constraint.
| | - `allowSquareMessage`_ |
| | - `allowLandscapeMessage`_ |
| | - `allowPortraitMessage`_ |
| | - `corruptedMessage`_ |
| | - See :doc:`File </reference/constraints/File>` for inherited options |
+----------------+-----------------------------------------------------------------------+
| Class | :class:`Symfony\\Component\\Validator\\Constraints\\Image` |
Expand Down Expand Up @@ -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
~~~~~~~~~~~~~~~~~~~~~~

Expand Down Expand Up @@ -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

0 comments on commit 6b1abf7

Please sign in to comment.