本文整理匯總了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;
}