Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
h3sands  
#1 Posted : Wednesday, October 24, 2012 4:10:46 AM(UTC)
h3sands

Rank: Newbie

Groups: Member
Joined: 10/23/2012(UTC)
Posts: 1

When testing samples I received this error:

Parse error: syntax error, unexpected '[' in .../Samples_iPhoneUploaderJavaScript/Includes/utils.php on line 103

103 $imageDimensions = getimagesize($fileName)[3];

According to PHP manual:

array getimagesize ( string $filename [, array &$imageinfo ] )

TIA

Dmitry.Obukhov  
#2 Posted : Wednesday, October 24, 2012 8:05:42 PM(UTC)
Dmitry.Obukhov

Rank: Advanced Member

Groups:
Joined: 5/29/2010(UTC)
Posts: 1,310

Thanks: 8 times
Was thanked: 111 time(s) in 111 post(s)
Hello,

Thank you for your report. Please try to replace this method:

Code:

public static function getImageSize($fileName)
{
  $imageSize = array();
  print_r(getimagesize($fileName));
  $imageDimensions = getimagesize($fileName)[3];
  preg_match('/width="(?P<width>\d+)"\s*height="(?P<height>\d+)"/', $imageDimensions, $matches);	      		

  $imageSize['width'] = $matches['width'];
  $imageSize['height'] = $matches['height'];

  return $imageSize;
}

with this one:

Code:

public static function getImageSize($fileName)
{
  $imageSize = array();

  $width = 0; $height = 0;
  list($width, $height, $type, $attr) = getimagesize($fileName);

  $imageSize['width'] = $width;
  $imageSize['height'] = $height;

  return $imageSize;
}

Then please test it and let me know about your result.

Also, send me an image you tried to upload. We need to check it.

Best regards,

Dmitry Obukhov

Technical Support. Aurigma, Inc.

Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.