public setQuality ( mixed $q = null ) : |
||
$q | mixed | |
Результат |
public function setQuality($q = null)
{
switch ($this->mime) {
case 'image/png':
$this->quality = $q < 10 ? 9 : 10 - round($q / 10, PHP_ROUND_HALF_DOWN);
break;
case 'image/jpeg':
$this->quality = round($q);
break;
default:
$this->quality = null;
}
return $this;
}
public function testPng() { $i = new Gd(__DIR__ . '/../tmp/test.png'); $i->setQuality(75)->setOpacity(50)->resizeToWidth(240); $this->assertEquals(240, $i->getWidth()); }