Bug #647

function generate_thumbnail generates warning

Added by Paolo Kimi about 2 years ago. Updated almost 2 years ago.

Status:Closed Start date:01/05/2010
Priority:Normal Due date:
Assignee:Ryan Gordon % Done:

100%

Category:PHP
Target version:1.4.12
Reproducibility:Always Database Type:
Reported In MyBB Version:1.4.11 Database Version:
PHP Version: SQA assignments:
Browser:

Description

In the file inc/functions_image.php the function generate_thumbnail() generates warning due to the following line:
list($imgwidth, $imgheight, $imgtype, $imgattr, $imgbits, $imgchan) = getimagesize($file);

the construct "list" accept only numerical array and the function getimagesize will generate something like:
Array[0] = Width
Array[1] = Height
Array[2] = Image Type Flag
Array[3] = width="xxx" height="xxx"
Array[bits] = bits
Array[channels] = channels
Array[mime] = mime-type

So $imgbits and $imgchan are empty.

a really simple solution could be

@ $file_size = getimagesize($file);

$imgwidth  = $file_size[0];
$imgheight = $file_size[1];
$imgtype = $file_size[2];
$imgattr = $file_size[3];
$imgbits = $file_size['bits'];
$imgchan = $file_size['channels'];
@

Associated revisions

Revision 4742
Added by Ryan Gordon about 2 years ago

Fixes function generate_thumbnail generates warning (fixes:647)

History

Updated by Ryan Gordon about 2 years ago

I'm curious as to why this hasn't been reported before if it's a legit issue

Updated by Ryan Gordon about 2 years ago

  • Status changed from New to Assigned
  • Assignee set to Ryan Gordon
  • Target version set to 1.4.12

Updated by Ryan Gordon about 2 years ago

  • Status changed from Assigned to Resolved
  • % Done changed from 0 to 100

Applied in changeset r4742.

Updated by Stefan T. almost 2 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF