method save documentation in bbn\File\Image
Save the image in a new destination if given or overwrite the file (default).
Example
$new_file="/home/data/test/Folder_test/image_test.jpeg";
$img2=new bbn\File\Image($new_file);
bbn\X::dump($img2->test());
// (bool) false
bbn\X::dump($img->save($new_file));
bbn\X::dump($img2->test());
// (bool) true
function($dest = false)
{
if ($this->test()) {
if (!$dest) {
$dest = $this->file;
}
$ext = Str::fileExt($dest);
if (in_array($ext, self::$allowed_extensions)) {
if ($ext === 'jpg') {
$ext = 'jpeg';
}
if (self::isImagick()) {
if ($ext !== $this->ext2) {
$this->img->setImageFormat($ext);
$this->img->setOption('webp:exact', 'true');
}
$this->img->writeImage($dest);
}
elseif (function_exists('image'.$ext)) {
if (!\call_user_func('image'.$ext, $this->img, $dest)) {
$this->error = X::_("The function %s doesn't exist", 'image'.$ext);
}
}
}
}
return $this;
}
Save the image in a new destination if given or overwrite the file (default). BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way
This website uses cookies to ensure you get the best experience on our website.
© 2011-2025
BBN Solutions