本文整理汇总了PHP中SimpleImage::fillTo方法的典型用法代码示例。如果您正苦于以下问题:PHP SimpleImage::fillTo方法的具体用法?PHP SimpleImage::fillTo怎么用?PHP SimpleImage::fillTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimpleImage
的用法示例。
在下文中一共展示了SimpleImage::fillTo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: remoteToLocalImage
private static function remoteToLocalImage($url, $path, $lim = false, $saveas = '', $quality = 75)
{
$im = @getimagesize($url);
if (!!$im) {
require_once 'Master/base/libraries/Images/SimpleImage.php';
$type = $im['mime'];
$width = $im[0];
$height = $im[1];
$minWidth = static::MIN_WIDTH;
$minHeight = static::MIN_HEIGHT;
$maxWidth = static::MAX_WIDTH;
$maxHeight = static::MAX_HEIGHT;
if (!!$lim) {
$lim = (object) $lim;
if (isset($lim->minWidth)) {
$minWidth = $lim->minWidth;
}
if (isset($lim->minHeight)) {
$minHeight = $lim->minHeight;
}
if (isset($lim->maxWidth)) {
$maxWidth = $lim->maxWidth;
}
if (isset($lim->maxHeight)) {
$maxHeight = $lim->maxHeight;
}
}
if ($width > $minWidth && $height > $minHeight && strpos($type, 'image') === 0) {
$ext = static::getExt($type);
if (!!$ext) {
$content = Remote::pull($url);
if (!!$content) {
$name = !!$saveas ? $saveas : Bella::createId(32);
$name .= $ext;
$file = $path . $name;
$save = @file_put_contents($file, $content);
if (!!$save) {
if ($width > $maxWidth || $height > $maxHeight) {
$sm = new SimpleImage();
$sm->load($file);
$sm->fillTo($maxWidth, $maxHeight);
$sm->save($file, false, $quality);
}
return $name;
}
}
}
}
}
return false;
}