1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27:
<?php
namespace Scene7\Commands;
trait Quality
{
public function setQuality($percentage, $chroma = null)
{
$percentage = (int) $percentage;
if ($percentage < 1 || $percentage > 100) {
throw new \InvalidArgumentException('Quality percentage must be between 1 and 100');
}
$quality = $percentage;
if ($chroma !== null) {
$quality .= ',' . ((int) (bool) $chroma);
}
$this->addCommand(array('qlt' => $quality));
return $this;
}
}