本文整理匯總了PHP中ImageManager::addBackgroundLayer方法的典型用法代碼示例。如果您正苦於以下問題:PHP ImageManager::addBackgroundLayer方法的具體用法?PHP ImageManager::addBackgroundLayer怎麽用?PHP ImageManager::addBackgroundLayer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ImageManager
的用法示例。
在下文中一共展示了ImageManager::addBackgroundLayer方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: createThumbnailOfImage
private function createThumbnailOfImage($imageName, $profilePic = false)
{
static $objImage, $arrSettings;
if (empty($objImage)) {
$objImage = new \ImageManager();
}
if (empty($arrSettings)) {
$arrSettings = \User_Setting::getSettings();
}
$cx = \Cx\Core\Core\Controller\Cx::instanciate();
if ($profilePic) {
if (!$objImage->loadImage($cx->getWebsiteImagesAccessProfilePath() . '/' . $imageName)) {
return false;
}
$rationWidth = $objImage->orgImageWidth / $arrSettings['profile_thumbnail_pic_width']['value'];
$rationHeight = $objImage->orgImageHeight / $arrSettings['profile_thumbnail_pic_height']['value'];
if ($arrSettings['profile_thumbnail_method']['value'] == 'crop') {
if ($rationWidth < $rationHeight) {
$objImage->orgImageHeight = $objImage->orgImageHeight / $rationHeight * $rationWidth;
} else {
$objImage->orgImageWidth = $objImage->orgImageWidth / $rationWidth * $rationHeight;
}
if (!$objImage->resizeImage($arrSettings['profile_thumbnail_pic_width']['value'], $arrSettings['profile_thumbnail_pic_height']['value'], 70)) {
return false;
}
} else {
$ration = max($rationWidth, $rationHeight);
$objImage->addBackgroundLayer(sscanf($arrSettings['profile_thumbnail_scale_color']['value'], '#%2X%2x%2x'), $arrSettings['profile_thumbnail_pic_width']['value'], $arrSettings['profile_thumbnail_pic_height']['value']);
}
$thumb_name = \ImageManager::getThumbnailFilename($cx->getWebsiteImagesAccessProfilePath() . '/' . $imageName);
return $objImage->saveNewImage($thumb_name, true);
} else {
$thumb_name = \ImageManager::getThumbnailFilename($imageName);
return $objImage->_createThumbWhq($cx->getWebsiteImagesAccessPhotoPath() . '/', $cx->getWebsiteImagesAccessPhotoWebPath() . '/', $imageName, $arrSettings['max_thumbnail_pic_width']['value'], $arrSettings['max_thumbnail_pic_height']['value'], 70, '', $cx->getWebsiteImagesAccessPhotoPath() . '/', $cx->getWebsiteImagesAccessPhotoWebPath() . '/', basename($cx->getWebsiteImagesAccessProfilePath() . '/' . $thumb_name));
}
}
示例2: createThumbnailOfImage
private function createThumbnailOfImage($imageName, $profilePic = false)
{
static $objImage, $arrSettings;
if (empty($objImage)) {
$objImage = new \ImageManager();
}
if (empty($arrSettings)) {
$arrSettings = \User_Setting::getSettings();
}
if ($profilePic) {
if (!$objImage->loadImage(ASCMS_ACCESS_PROFILE_IMG_PATH . '/' . $imageName)) {
return false;
}
$rationWidth = $objImage->orgImageWidth / $arrSettings['profile_thumbnail_pic_width']['value'];
$rationHeight = $objImage->orgImageHeight / $arrSettings['profile_thumbnail_pic_height']['value'];
if ($arrSettings['profile_thumbnail_method']['value'] == 'crop') {
if ($rationWidth < $rationHeight) {
$objImage->orgImageHeight = $objImage->orgImageHeight / $rationHeight * $rationWidth;
} else {
$objImage->orgImageWidth = $objImage->orgImageWidth / $rationWidth * $rationHeight;
}
if (!$objImage->resizeImage($arrSettings['profile_thumbnail_pic_width']['value'], $arrSettings['profile_thumbnail_pic_height']['value'], 70)) {
return false;
}
} else {
$ration = max($rationWidth, $rationHeight);
$objImage->addBackgroundLayer(sscanf($arrSettings['profile_thumbnail_scale_color']['value'], '#%2X%2x%2x'), $arrSettings['profile_thumbnail_pic_width']['value'], $arrSettings['profile_thumbnail_pic_height']['value']);
}
$thumb_name = \ImageManager::getThumbnailFilename($imageName);
return $objImage->saveNewImage(ASCMS_ACCESS_PROFILE_IMG_PATH . '/' . $thumb_name);
} else {
return $objImage->_createThumbWhq(ASCMS_ACCESS_PHOTO_IMG_PATH . '/', ASCMS_ACCESS_PHOTO_IMG_WEB_PATH . '/', $imageName, $arrSettings['max_thumbnail_pic_width']['value'], $arrSettings['max_thumbnail_pic_height']['value'], 70);
}
}