public static function dimensions($value, array $dimensions)
    {
        $fileDimensions = getimagesize($value['tmp_name']);

        if ($fileDimensions === false) {
            return false;
        }

        $sourceWidth = $fileDimensions[0];
        $sourceHeight = $fileDimensions[1];

        foreach ($dimensions as $rule => $sizes) {
            if ($rule === 'min') {
                if (isset($sizes['w']) && $sourceWidth < $sizes['w']) {
                    return false;
                }
                if (isset($sizes['h']) && $sourceHeight < $sizes['h']) {
                    return false;
                }
            } elseif ($rule === 'max') {
                if (isset($sizes['w']) && $sourceWidth > $sizes['w']) {
                    return false;
                }
                if (isset($sizes['h']) && $sourceHeight > $sizes['h']) {
                    return false;
                }
            }
        }

        return true;
    }