annotate vendor/symfony/validator/Constraints/Image.php @ 19:fa3358dc1485 tip

Add ndrum files
author Chris Cannam
date Wed, 28 Aug 2019 13:14:47 +0100
parents 129ea1e6d783
children
rev   line source
Chris@0 1 <?php
Chris@0 2
Chris@0 3 /*
Chris@0 4 * This file is part of the Symfony package.
Chris@0 5 *
Chris@0 6 * (c) Fabien Potencier <fabien@symfony.com>
Chris@0 7 *
Chris@0 8 * For the full copyright and license information, please view the LICENSE
Chris@0 9 * file that was distributed with this source code.
Chris@0 10 */
Chris@0 11
Chris@0 12 namespace Symfony\Component\Validator\Constraints;
Chris@0 13
Chris@0 14 /**
Chris@0 15 * @Annotation
Chris@0 16 * @Target({"PROPERTY", "METHOD", "ANNOTATION"})
Chris@0 17 *
Chris@0 18 * @author Benjamin Dulau <benjamin.dulau@gmail.com>
Chris@0 19 * @author Bernhard Schussek <bschussek@gmail.com>
Chris@0 20 */
Chris@0 21 class Image extends File
Chris@0 22 {
Chris@0 23 const SIZE_NOT_DETECTED_ERROR = '6d55c3f4-e58e-4fe3-91ee-74b492199956';
Chris@0 24 const TOO_WIDE_ERROR = '7f87163d-878f-47f5-99ba-a8eb723a1ab2';
Chris@0 25 const TOO_NARROW_ERROR = '9afbd561-4f90-4a27-be62-1780fc43604a';
Chris@0 26 const TOO_HIGH_ERROR = '7efae81c-4877-47ba-aa65-d01ccb0d4645';
Chris@0 27 const TOO_LOW_ERROR = 'aef0cb6a-c07f-4894-bc08-1781420d7b4c';
Chris@14 28 const TOO_FEW_PIXEL_ERROR = '1b06b97d-ae48-474e-978f-038a74854c43';
Chris@14 29 const TOO_MANY_PIXEL_ERROR = 'ee0804e8-44db-4eac-9775-be91aaf72ce1';
Chris@0 30 const RATIO_TOO_BIG_ERROR = '70cafca6-168f-41c9-8c8c-4e47a52be643';
Chris@0 31 const RATIO_TOO_SMALL_ERROR = '59b8c6ef-bcf2-4ceb-afff-4642ed92f12e';
Chris@0 32 const SQUARE_NOT_ALLOWED_ERROR = '5d41425b-facb-47f7-a55a-de9fbe45cb46';
Chris@0 33 const LANDSCAPE_NOT_ALLOWED_ERROR = '6f895685-7cf2-4d65-b3da-9029c5581d88';
Chris@0 34 const PORTRAIT_NOT_ALLOWED_ERROR = '65608156-77da-4c79-a88c-02ef6d18c782';
Chris@0 35 const CORRUPTED_IMAGE_ERROR = '5d4163f3-648f-4e39-87fd-cc5ea7aad2d1';
Chris@0 36
Chris@0 37 // Include the mapping from the base class
Chris@0 38
Chris@17 39 protected static $errorNames = [
Chris@0 40 self::NOT_FOUND_ERROR => 'NOT_FOUND_ERROR',
Chris@0 41 self::NOT_READABLE_ERROR => 'NOT_READABLE_ERROR',
Chris@0 42 self::EMPTY_ERROR => 'EMPTY_ERROR',
Chris@0 43 self::TOO_LARGE_ERROR => 'TOO_LARGE_ERROR',
Chris@0 44 self::INVALID_MIME_TYPE_ERROR => 'INVALID_MIME_TYPE_ERROR',
Chris@0 45 self::SIZE_NOT_DETECTED_ERROR => 'SIZE_NOT_DETECTED_ERROR',
Chris@0 46 self::TOO_WIDE_ERROR => 'TOO_WIDE_ERROR',
Chris@0 47 self::TOO_NARROW_ERROR => 'TOO_NARROW_ERROR',
Chris@0 48 self::TOO_HIGH_ERROR => 'TOO_HIGH_ERROR',
Chris@0 49 self::TOO_LOW_ERROR => 'TOO_LOW_ERROR',
Chris@14 50 self::TOO_FEW_PIXEL_ERROR => 'TOO_FEW_PIXEL_ERROR',
Chris@14 51 self::TOO_MANY_PIXEL_ERROR => 'TOO_MANY_PIXEL_ERROR',
Chris@0 52 self::RATIO_TOO_BIG_ERROR => 'RATIO_TOO_BIG_ERROR',
Chris@0 53 self::RATIO_TOO_SMALL_ERROR => 'RATIO_TOO_SMALL_ERROR',
Chris@0 54 self::SQUARE_NOT_ALLOWED_ERROR => 'SQUARE_NOT_ALLOWED_ERROR',
Chris@0 55 self::LANDSCAPE_NOT_ALLOWED_ERROR => 'LANDSCAPE_NOT_ALLOWED_ERROR',
Chris@0 56 self::PORTRAIT_NOT_ALLOWED_ERROR => 'PORTRAIT_NOT_ALLOWED_ERROR',
Chris@0 57 self::CORRUPTED_IMAGE_ERROR => 'CORRUPTED_IMAGE_ERROR',
Chris@17 58 ];
Chris@0 59
Chris@0 60 public $mimeTypes = 'image/*';
Chris@0 61 public $minWidth;
Chris@0 62 public $maxWidth;
Chris@0 63 public $maxHeight;
Chris@0 64 public $minHeight;
Chris@0 65 public $maxRatio;
Chris@0 66 public $minRatio;
Chris@14 67 public $minPixels;
Chris@14 68 public $maxPixels;
Chris@0 69 public $allowSquare = true;
Chris@0 70 public $allowLandscape = true;
Chris@0 71 public $allowPortrait = true;
Chris@0 72 public $detectCorrupted = false;
Chris@0 73
Chris@0 74 // The constant for a wrong MIME type is taken from the parent class.
Chris@0 75 public $mimeTypesMessage = 'This file is not a valid image.';
Chris@0 76 public $sizeNotDetectedMessage = 'The size of the image could not be detected.';
Chris@0 77 public $maxWidthMessage = 'The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px.';
Chris@0 78 public $minWidthMessage = 'The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px.';
Chris@0 79 public $maxHeightMessage = 'The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px.';
Chris@0 80 public $minHeightMessage = 'The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px.';
Chris@14 81 public $minPixelsMessage = 'The image has too few pixels ({{ pixels }} pixels). Minimum amount expected is {{ min_pixels }} pixels.';
Chris@14 82 public $maxPixelsMessage = 'The image has too many pixels ({{ pixels }} pixels). Maximum amount expected is {{ max_pixels }} pixels.';
Chris@0 83 public $maxRatioMessage = 'The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}.';
Chris@0 84 public $minRatioMessage = 'The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}.';
Chris@0 85 public $allowSquareMessage = 'The image is square ({{ width }}x{{ height }}px). Square images are not allowed.';
Chris@0 86 public $allowLandscapeMessage = 'The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed.';
Chris@0 87 public $allowPortraitMessage = 'The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed.';
Chris@0 88 public $corruptedMessage = 'The image file is corrupted.';
Chris@0 89 }