Skip to main content
Version: Fegg 5.x

Trim::create

Save the image to the output path

Description​

public bool Trim::create()

Saves the resized image to the output path given to Trim::setImage. Missing directories are created. JPEG images are saved with quality 90.

The image is written next to the output path first and then renamed, so a request at the same time never reads half a file. Returns false when it could not be saved.

Example​

Controller
use Fegg\Tool\Trim;

$trim = new Trim();
$trim->setImage('path/to/image.jpg', 'path/to/converted.jpg');

$trim->resizeTrim(300, 300, 'm');
if (!$trim->create()) {
// could not be saved
}