本文整理汇总了PHP中SimpleImage::invert方法的典型用法代码示例。如果您正苦于以下问题:PHP SimpleImage::invert方法的具体用法?PHP SimpleImage::invert怎么用?PHP SimpleImage::invert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimpleImage
的用法示例。
在下文中一共展示了SimpleImage::invert方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validateSponsorImage
/**
* Verify and validate the extension of the uploaded file.
*
* @param string $name
* @param string $type
* @return boolean
*/
public function validateSponsorImage($name, $tmpName, $type)
{
$allowedExtensions = array("gif", "jpeg", "jpg", "png", "pdf", "GIF", "JPEG", "JPG", "PNG", "PDF");
$temp = explode(".", $name);
$extension = end($temp);
if (($type === "image/gif" || $type === "image/jpeg" || $type === "image/jpg" || $type === "image/pjpeg" || $type === "image/x-png" || $type === "image/png" || $type === "application/pdf") && in_array($extension, $allowedExtensions)) {
$img = new SimpleImage($tmpName);
$img->fit_to_width(360);
$img->invert();
$img->crop(0, ($img->get_height() - 190) / 2, 360, ($img->get_height() - 190) / 2 + 190);
$img->invert();
$img->save("_temp/_img.png");
return true;
} else {
return false;
}
}