From ed64c6a6151eafc9fefda9ebe89ee10dadc0e5cf Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 5 Apr 2016 15:13:37 +0200 Subject: [PATCH 1/3] Documented the detectCorrupted and corruptedMessage options --- reference/constraints/Image.rst | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/reference/constraints/Image.rst b/reference/constraints/Image.rst index 0720326c0a3..0c1902ceb5a 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 tha the +images is not corrupted. This validation is done with PHP's ``imagecreatefromstring()`` +function, which requires the PHP GD extension to be enabled. + sizeNotDetectedMessage ~~~~~~~~~~~~~~~~~~~~~~ @@ -392,4 +406,15 @@ 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 if the image contents are corrupted and you set `detectCorrupted`_ +to ``true``. + .. _`IANA website`: http://www.iana.org/assignments/media-types/image/index.html From f11d1be6563ae28ac3341aa6d4dbd090ebf5bdd9 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 6 Apr 2016 08:48:11 +0200 Subject: [PATCH 2/3] Fixed typos --- reference/constraints/Image.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/reference/constraints/Image.rst b/reference/constraints/Image.rst index 0c1902ceb5a..e2b04871e80 100644 --- a/reference/constraints/Image.rst +++ b/reference/constraints/Image.rst @@ -321,8 +321,8 @@ detectCorrupted **type**: ``Boolean`` **default**: ``false`` -If this option is true, the image contents are validated to ensure tha the -images is not corrupted. This validation is done with PHP's ``imagecreatefromstring()`` +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 ``imagecreatefromstring()`` function, which requires the PHP GD extension to be enabled. sizeNotDetectedMessage From d68c893e89c58a12c393e3fa45165c5e291277b7 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 3 May 2016 10:26:36 +0200 Subject: [PATCH 3/3] Changed according to reviewers --- reference/constraints/Image.rst | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/reference/constraints/Image.rst b/reference/constraints/Image.rst index e2b04871e80..a326174a970 100644 --- a/reference/constraints/Image.rst +++ b/reference/constraints/Image.rst @@ -319,11 +319,11 @@ detectCorrupted .. versionadded:: 3.1 The ``detectCorrupted`` option was introduced in Symfony 3.1. -**type**: ``Boolean`` **default**: ``false`` +**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 ``imagecreatefromstring()`` -function, which requires the PHP GD extension to be enabled. +image is not corrupted. This validation is done with PHP's :phpfunction:`imagecreatefromstring` +function, which requires the `PHP GD extension`_ to be enabled. sizeNotDetectedMessage ~~~~~~~~~~~~~~~~~~~~~~ @@ -414,7 +414,8 @@ corruptedMessage **type**: ``string`` **default**: ``The image file is corrupted.`` -The error message if the image contents are corrupted and you set `detectCorrupted`_ -to ``true``. +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