Skip to content

Commit 8e6f084

Browse files
committed
[#2840] Minor tweaks to new orientation Image validation constraints
1 parent 6f0c697 commit 8e6f084

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

reference/constraints/Image.rst

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ Additionally it has options so you can validate against the width and height
99
of the image.
1010

1111
.. versionadded:: 2.4
12-
As of Symfony 2.4 you can also validate against the image aspect ratio ( defined
13-
as ``width / height``) and selectively allow square, landscape and portrait
14-
image orientations.
12+
As of Symfony 2.4 you can also validate against the image aspect ratio
13+
(defined as ``width / height``) and selectively allow square, landscape
14+
and portrait image orientations.
1515

1616
See the :doc:`File</reference/constraints/File>` constraint for the bulk of
1717
the documentation on this constraint.
@@ -284,47 +284,49 @@ value in pixels.
284284
maxRatio
285285
~~~~~~~~
286286

287-
**type**: ``integer``
287+
**type**: ``float``
288288

289-
If set, the aspect ratio (``width / height``) of the image file must be less than or equal to this
290-
value.
289+
If set, the aspect ratio (``width / height``) of the image file must be less
290+
than or equal to this value.
291291

292292
minRatio
293293
~~~~~~~~
294294

295-
**type**: ``integer``
295+
**type**: ``float``
296296

297-
If set, the aspect ratio (``width / height``) of the image file must be greater than or equal to this
298-
value.
297+
If set, the aspect ratio (``width / height``) of the image file must be greater
298+
than or equal to this value.
299299

300300
allowSquare
301301
~~~~~~~~~~~
302302

303303
**type**: ``Boolean`` **default**: ``true``
304304

305-
If this option is false, the image must not be square.
305+
If this option is false, the image cannot be a square. If you want to force
306+
a square image, then set leave this option as its default ``true`` value
307+
and set `allowLandscape`_ and `allowPortrait`_ both to ``false``.
306308

307309
allowLandscape
308310
~~~~~~~~~~~~~~
309311

310312
**type**: ``Boolean`` **default**: ``true``
311313

312-
If this option is false, the image must not be landscape oriented.
314+
If this option is false, the image cannot be landscape oriented.
313315

314316
allowPortrait
315317
~~~~~~~~~~~~~
316318

317319
**type**: ``Boolean`` **default**: ``true``
318320

319-
If this option is false, the image must not be portrait oriented.
321+
If this option is false, the image cannot be portrait oriented.
320322

321323
sizeNotDetectedMessage
322324
~~~~~~~~~~~~~~~~~~~~~~
323325

324326
**type**: ``string`` **default**: ``The size of the image could not be detected``
325327

326328
If the system is unable to determine the size of the image, this error will
327-
be displayed. This will only occur when at least one of the four size constraint
329+
be displayed. This will only occur when at least one of the size constraint
328330
options has been set.
329331

330332
maxWidthMessage
@@ -397,6 +399,6 @@ allowPortraitMessage
397399
**type**: ``string`` **default**: ``The image is portrait oriented ({{ width }}x{{ height }}px).
398400
Portrait oriented images are not allowed``
399401

400-
The error message if the image is portrait oriented and you set `allowPoirtrait`_ to ``false``.
402+
The error message if the image is portrait oriented and you set `allowPortrait`_ to ``false``.
401403

402404
.. _`IANA website`: http://www.iana.org/assignments/media-types/image/index.html

0 commit comments

Comments
 (0)