note 126438 added to imagick.trimimage
| From: | tamucola at main dot php dot net | Date: | Mon, 20 Sep 2021 04:31:35 +0000 |
| Subject: | note 126438 added to imagick.trimimage | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-216976@lists.php.net to get a copy of this message | ||
fuzz needs getQuantum
/**
* @param string $imagePath
* @param float $fuzz 0.1=10%
* @return bool
* @throws ImagickException
*/
public static function trimImage($imagePath, $fuzz = 0.1)
{
if (empty($imagePath)) {
return false;
}
$imagePath = realpath($imagePath);
if (!is_file($imagePath)) {
return false;
}
if (!class_exists('Imagick')) {
return false;
}
$im = new Imagick($imagePath);
$result = $im->trimImage($fuzz * $im::getQuantum());
if (!$result) {
return false;
}
return $im->writeImage($imagePath);
}
----
Server IP: 45.112.84.4
Probable Submitter: 45.112.85.242 (proxied: 202.171.152.254)
----
Manual Page -- https://php.net/manual/en/imagick.trimimage.php
Edit -- https://main.php.net/note/edit/126438
Del: integrated -- https://main.php.net/note/delete/126438/integrated
Del: useless -- https://main.php.net/note/delete/126438/useless
Del: bad code -- https://main.php.net/note/delete/126438/bad+code
Del: spam -- https://main.php.net/note/delete/126438/spam
Del: non-english -- https://main.php.net/note/delete/126438/non-english
Del: in docs -- https://main.php.net/note/delete/126438/in+docs
Del: other reasons-- https://main.php.net/note/delete/126438
Reject -- https://main.php.net/note/reject/126438
Search -- https://main.php.net/manage/user-notes.php