phpThumb
phpThumb copied to clipboard
I have some questions about FAR code
function FixedAspectRatio() {
// optional fixed-dimension images (regardless of aspect ratio)
if (!$this->far) {
// do nothing
return true;
}
if (!$this->w || !$this->h) {
return false;
}
$this->thumbnail_width = $this->w;
$this->thumbnail_height = $this->h;
$this->is_alpha = true;
if ($this->thumbnail_image_width >= $this->thumbnail_width) {
$aspectratio = $this->thumbnail_image_height / $this->thumbnail_image_width;
if ($this->w) {
$this->thumbnail_image_height = round($this->thumbnail_image_width * $aspectratio);
$this->thumbnail_height = ($this->h ? $this->h : $this->thumbnail_image_height);
} elseif ($this->thumbnail_image_height < $this->thumbnail_height) {
$this->thumbnail_image_height = $this->thumbnail_height;
$this->thumbnail_image_width = round($this->thumbnail_image_height / $aspectratio);
}
} else {
$aspectratio = $this->thumbnail_image_width / $this->thumbnail_image_height;
if ($this->h) {
$this->thumbnail_image_width = round($this->thumbnail_image_height * $aspectratio);
} elseif ($this->thumbnail_image_width < $this->thumbnail_width) {
$this->thumbnail_image_width = $this->thumbnail_width;
$this->thumbnail_image_height = round($this->thumbnail_image_width / $aspectratio);
}
}
return true;
}
this lines if w==0 or h==0 than exit. weight and height must be not zero
if (!$this->w || !$this->h) {
return false;
}
but in this lines we check the same, we can't go next "elseif"
if ($this->w) {
if ($this->h) {