2012-07-04 30 views
1

尝试将2添加到整数时出现此错误。我正在使用Codeigniter框架。当值为整数时,不支持的操作数类型

Fatal error: Unsupported operand types in D:\wamp\www\application\libraries\Gen_images.php on line 180

这里就是其所谓的:

// Now process the image 
var_dump($this->upload->data('image_width')); 
$this->gen_login->resize($file_name, $this->upload->data('image_width'), $this->upload->data('image_height')); 

我得到line 180错误是:

$config['width'] = $width + 2; 

所以我想$宽度必须是一个数组或字符串,所以我不会无法添加,但var dump显示:

array 
    'file_name' => string 'genyx_1341414096.jpg' (length=20) 
    'file_type' => string 'image/jpeg' (length=10) 
    'file_path' => string 'D:/wamp/www/beer/uploads/' (length=25) 
    'full_path' => string 'D:/wamp/www/beer/uploads/genyx_1341414096.jpg' (length=45) 
    'raw_name' => string 'genyx_1341414096' (length=16) 
    'orig_name' => string 'genyx_1341414096.jpg' (length=20) 
    'client_name' => string '294207_177080222375077_100002193022560_361510_991268937_s.jpg' (length=61) 
    'file_ext' => string '.jpg' (length=4) 
    'file_size' => float 55.85 
    'is_image' => boolean true 
    'image_width' => int 720 
    'image_height' => int 479 
    'image_type' => string 'jpeg' (length=4) 
    'image_size_str' => string 'width="720" height="479"' (length=24) 

任何人都可以帮助我吗?

+0

你有没有尝试像(int)$ width一样投射$ width? –

+0

'var_dump($ witdh)'的结果是什么? – Florent

+0

var_dump($ width);似乎给予完全一样的另一个var_dump ... – Adam

回答

0

并没有一个名为$width在上面显示的任何代码的变量...

$width是最肯定不是一个字符串。我可以保证。

+0

它被传递给函数:public function resize($ oldFile,$ width,$ height) – Adam

相关问题