Pop\Image\Gd::scale PHP Метод

scale() публичный Метод

Scale the image object
public scale ( float | string $scl ) : Gd
$scl float | string
Результат Gd
    public function scale($scl)
    {
        // Determine the new width and height of the image based on the
        // value of the $scl argument.
        $wid = round($this->width * $scl);
        $hgt = round($this->height * $scl);
        // Create a new image output resource.
        $this->createResource();
        $this->output = imagecreatetruecolor($wid, $hgt);
        // Copy newly sized image to the output resource.
        $this->copyImage($wid, $hgt);
        return $this;
    }

Usage Example

Пример #1
0
 public function testScale()
 {
     $i = new Gd(__DIR__ . '/../tmp/test.jpg');
     $i->scale(0.1);
     $this->assertEquals(64, $i->getWidth());
 }