public function resize($px)
{
// Determine whether or not the image is landscape or portrait and set
// the scale, new width and new height accordingly, with the largest
// dimension being scaled to the value of the $px argument.
$this->setImageInfo();
$scale = $this->width > $this->height ? $px / $this->width : $px / $this->height;
$wid = round($this->width * $scale);
$hgt = round($this->height * $scale);
// Create a new image output resource.
$this->resource->resizeImage($wid, $hgt, $this->filter, $this->blur);
$this->setImageInfo();
return $this;
}