protected function validateImage($image)
{
if (false === ($imageInfo = getimagesize($image->tempName))) {
return [$this->notImage, ['file' => $image->name]];
}
list($width, $height) = $imageInfo;
if ($width == 0 || $height == 0) {
return [$this->notImage, ['file' => $image->name]];
}
if ($this->minWidth !== null && $width < $this->minWidth) {
return [$this->underWidth, ['file' => $image->name, 'limit' => $this->minWidth]];
}
if ($this->minHeight !== null && $height < $this->minHeight) {
return [$this->underHeight, ['file' => $image->name, 'limit' => $this->minHeight]];
}
if ($this->maxWidth !== null && $width > $this->maxWidth) {
return [$this->overWidth, ['file' => $image->name, 'limit' => $this->maxWidth]];
}
if ($this->maxHeight !== null && $height > $this->maxHeight) {
return [$this->overHeight, ['file' => $image->name, 'limit' => $this->maxHeight]];
}
return null;
}