本文整理匯總了PHP中ImageManager::resizeImageSave方法的典型用法代碼示例。如果您正苦於以下問題:PHP ImageManager::resizeImageSave方法的具體用法?PHP ImageManager::resizeImageSave怎麽用?PHP ImageManager::resizeImageSave使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ImageManager
的用法示例。
在下文中一共展示了ImageManager::resizeImageSave方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: rotatePicture
/**
* Rotates an image clockwise by 90�
*
* @global ADONewConnection
* @global array
* @global array
*/
function rotatePicture($intImageId)
{
global $objDatabase, $_ARRAYLANG, $_CONFIG;
if (!function_exists('imagerotate')) {
$this->strErrMessage = $_ARRAYLANG['TXT_GALLERY_GD_LIB_NOT_INSTALLED'];
return false;
}
$objResult = $objDatabase->Execute('SELECT path,
quality,
size_type,
size_proz,
size_abs_h,
size_abs_w
FROM ' . DBPREFIX . 'module_gallery_pictures
WHERE id=' . $intImageId);
$strImagename = $objResult->fields['path'];
$strOrgPath = $this->strImagePath;
$strWebpath = $this->strImageWebPath;
$strThumbPath = $this->strThumbnailPath;
$strThumbWebpath = $this->strThumbnailWebPath;
$objImage = new \ImageManager();
$objImage->loadImage($strOrgPath . $strImagename);
//Rotate the clockwise
if ($objImage->rotateImage(270)) {
//To save the Rotated image
if ($objImage->saveNewImage($strOrgPath . $strImagename, true)) {
\Cx\Lib\FileSystem\FileSystem::delete_file($strThumbPath . $strImagename);
}
$imageSize = $objImage->_getImageSize($strOrgPath . $strImagename);
$intOldWidth = $imageSize[0];
$intOldHeight = $imageSize[1];
if ($objResult->fields['size_type'] == 'abs') {
$intNewWidth = intval($this->arrSettings['standard_width_abs']);
$intNewHeight = intval($this->arrSettings['standard_height_abs']);
if ($intNewWidth == 0) {
// exception if width and height or 0!
if ($intNewHeight == 0) {
$intNewHeight = 100;
}
$intNewWidth = round($intOldWidth * $intNewHeight / $intOldHeight, 0);
} else {
if ($intNewHeight == 0) {
$intNewHeight = round($intOldHeight * $intNewWidth / $intOldWidth, 0);
}
}
} else {
$intNewWidth = round($objResult->fields['size_proz'] / 100 * $intOldWidth, 0);
$intNewHeight = round($objResult->fields['size_proz'] / 100 * $intOldHeight, 0);
}
//Resize the Rotated image
if ($objImage->resizeImageSave($strOrgPath, $strWebpath, $strImagename, $intNewWidth, $intNewHeight, $objResult->fields['quality'], $strThumbPath, $strThumbWebpath, $strImagename)) {
if ($objResult->fields['size_type'] == 'abs') {
$objDatabase->Execute(' UPDATE ' . DBPREFIX . 'module_gallery_pictures
SET size_abs_h=' . $intNewHeight . ',
size_abs_w=' . $intNewWidth . '
WHERE id=' . $intImageId);
}
}
}
}