ImageFile.php
TLDR
The ImageFile.php
file is a class that extends the File
class in the Illuminate\Validation\Rules
namespace. It represents a rule for validating image files.
Classes
ImageFile
The ImageFile
class is a rule class that extends the File
class. It is used for validating image files. It has the following methods:
-
__construct()
: Initializes a new instance of theImageFile
class. It sets the rule to'image'
. -
dimensions($dimensions)
: Sets the dimension constraints for the uploaded file. Accepts an instance of theIlluminate\Validation\Rules\Dimensions
class as a parameter. It adds the dimension rules to the existing rules.
<?php
namespace Illuminate\Validation\Rules;
class ImageFile extends File
{
/**
* Create a new image file rule instance.
*
* @return void
*/
public function __construct()
{
$this->rules('image');
}
/**
* The dimension constraints for the uploaded file.
*
* @param \Illuminate\Validation\Rules\Dimensions $dimensions
*/
public function dimensions($dimensions)
{
$this->rules($dimensions);
return $this;
}
}