public function scale($iWidthNew, $iHeightNew, $bResample = false) { $iWidth = $this->getWidth(); $iHeight = $this->getHeight(); if ($iWidthNew == $iWidth && $iHeightNew == $iHeight) { // yeah, sure return; } $scaledImage = new GDImage($iWidthNew, $iHeightNew); $scaledImage->setAntiAlias($this->isAntiAlias()); $scaledImage->setAlphaBlending($this->isAlphaBlending()); $scaledImage->set8BitAlpha($this->is8BitAlpha()); if ($bResample) { $scaledImage->copyResampled($this, 0, 0, 0, 0, $iWidthNew, $iHeightNew, $iWidth, $iHeight); } else { $scaledImage->copyResized($this, 0, 0, 0, 0, $iWidthNew, $iHeightNew, $iWidth, $iHeight); } $this->replace($scaledImage); }