数组定义用法统一

This commit is contained in:
thinkphp
2013-04-11 14:49:39 +08:00
parent bbe3ebedcf
commit 00ee80e943
35 changed files with 83 additions and 81 deletions

View File

@@ -50,12 +50,12 @@ class Gd{
}
//设置图像信息
$this->info = array(
$this->info = [
'width' => $info[0],
'height' => $info[1],
'type' => image_type_to_extension($info[2], false),
'mime' => $info['mime'],
);
];
//销毁已存在的图像
empty($this->im) || imagedestroy($this->im);
@@ -146,7 +146,7 @@ class Gd{
*/
public function size(){
if(empty($this->im)) throw new Exception('没有指定图像资源');
return array($this->info['width'], $this->info['height']);
return [$this->info['width'], $this->info['height']];
}
/**

View File

@@ -50,12 +50,12 @@ class Imagick{
$this->im = new \Imagick(realpath($imgname));
//设置图像信息
$this->info = array(
$this->info = [
'width' => $this->im->getImageWidth(),
'height' => $this->im->getImageHeight(),
'type' => strtolower($this->im->getImageFormat()),
'mime' => $this->im->getImageMimeType(),
);
];
}
/**
@@ -134,7 +134,7 @@ class Imagick{
*/
public function size(){
if(empty($this->im)) throw new Exception('没有指定图像资源');
return array($this->info['width'], $this->info['height']);
return [$this->info['width'], $this->info['height']];
}
/**
@@ -353,7 +353,7 @@ class Imagick{
//创建水印图像资源
$water = new Imagick(realpath($source));
$info = array($water->getImageWidth(), $water->getImageHeight());
$info = [$water->getImageWidth(), $water->getImageHeight()];
/* 设定水印位置 */
switch ($locate) {