protected function validateAspectRatio($width, $height)
    {
        /**
         * Allow aspect ratio given?
         */
        if ($this->allowAspectRatioX && $this->allowAspectRatioY) {
            $gcd = $this->gcd($width, $height);
            $x = $width / $gcd;
            $y = $height / $gcd;

            if ($x != $this->allowAspectRatioX || $y != $this->allowAspectRatioY) {
                $this->setErrorMessage(sprintf(
                    $this->messages['aspect_ratio'],
                    $x . ':' . $y,
                    $this->allowAspectRatioX . ':' . $this->allowAspectRatioY
                ));
                return false;
            }
        }

        /**
         * Deny aspect ratio given?
         */
        if ($this->denyAspectRatioX && $this->denyAspectRatioY) {
            $gcd = $this->gcd($width, $height);
            $x = $width / $gcd;
            $y = $height / $gcd;

            if ($x == $this->denyAspectRatioX && $y == $this->denyAspectRatioY) {
                $this->setErrorMessage(sprintf(
                    $this->messages['aspect_ratio_denied'],
                    $x . ':' . $y
                ));
                return false;
            }
        }

        return true;
    }