本文整理汇总了PHP中ImageHelper::resize方法的典型用法代码示例。如果您正苦于以下问题:PHP ImageHelper::resize方法的具体用法?PHP ImageHelper::resize怎么用?PHP ImageHelper::resize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageHelper
的用法示例。
在下文中一共展示了ImageHelper::resize方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: resize
public function resize($path, $width, $height, $options = array(), $htmlAttributes = array(), $return = false)
{
$filename = basename($path);
$uploadsDir = dirname(basename($path));
if ($uploadsDir === '.') {
$uploadsDir = '';
}
$cacheDir = dirname($path);
$options = Hash::merge(array('aspect' => true, 'adapter' => false, 'cacheDir' => $cacheDir, 'uploadsDir' => $uploadsDir), $options);
$adapter = $options['adapter'];
if ($adapter === 'LegacyLocalAttachment') {
$options['cacheDir'] = 'resized';
$options['resizedInd'] = '.resized-';
$options['uploadsDir'] = 'uploads';
}
$result = parent::resize($path, $width, $height, $options, $htmlAttributes, $return);
$data = compact('result', 'path', 'width', 'height', 'aspect', 'htmlAttributes', 'adapter');
Croogo::dispatchEvent('Assets.AssetsImageHelper.resize', $this->_View, $data);
return $result;
}
示例2: holderUrl
public static function holderUrl($url, $width, $height)
{
if ($url) {
return $url;
}
$noImgSrc = Yii::getPathOfAlias('webroot') . '/upload/noimage/noimage-all.jpg';
$noImg = Yii::getPathOfAlias('webroot') . "/upload/noimage/{$width}x{$height}.jpg";
$noImageUrl = Yii::app()->baseUrl . "/upload/noimage/{$width}x{$height}.jpg";
// resize the placeholder image file
if (!is_file($noImg)) {
ImageHelper::resize($noImgSrc, $noImg, $width, $height);
}
return $noImageUrl;
}
示例3: getImageUrl
public function getImageUrl($width = null, $height = null, $watermark = false)
{
$imgFile = $this->generateImagePath($width, $height, $watermark);
if (!is_file($imgFile)) {
// resize image
$srcImg = $this->generateImagePath();
ImageHelper::resize($srcImg, $imgFile, $width, $height, array('fit' => false));
}
$imgUrl = $this->generateImageUrl($width, $height, $watermark);
return is_file($imgFile) ? $imgUrl : null;
}
示例4: generateImageUrl
if (!$width && !$height) {
unset($paths[4]);
}
return implode('/', $paths);
}
/*
* Generate the image url corresponding to the dimension
* Need to change the code when copy to another model
*
* @author Lam Huynh
*/
protected function generateImageUrl($width = null, $height = null)
{
示例5: getAccountType
}
return '';
}
/**
* @Author: ANH DUNG Sep 04, 2014
* @Todo: display account type of user
* @Param: $role_id of user
*/
public static function getAccountType($role_id)
{
if (isset(Users::$ACCOUNT_TYPE[$role_id])) {
return Users::$ACCOUNT_TYPE[$role_id];