當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ImageManager::addBackgroundLayer方法代碼示例

本文整理匯總了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));
     }
 }
開發者ID:Niggu,項目名稱:cloudrexx,代碼行數:36,代碼來源:AccessLib.class.php

示例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);
     }
 }
開發者ID:nahakiole,項目名稱:cloudrexx,代碼行數:34,代碼來源:AccessLib.class.php


注:本文中的ImageManager::addBackgroundLayer方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。