Bug in ImageBrowser

2 posts, 0 answers
  1. Rinck
    Rinck avatar
    23 posts
    Member since:
    Feb 2013

    Posted 05 Apr 2013 Link to this post

    Hi,
    I'm experimenting with the IimageBrowser (php) and ran into an issue.

    When creating a new instance of the ImageBrowser class, I received an error:
    Parse error: syntax error, unexpected '[' in /var/www/test/Kendo/ImageBrowser.php on line 43
    That line contains the following function (the second line is the culprit here):
    function getImageType($filename) {
        $type = getimagesize($filename)[2];
     
        if ($type == IMAGETYPE_JPEG) {
            $type = 'jpeg';
        } elseif ($type == IMAGETYPE_GIF) {
            $type = 'gif';
        } elseif ($type == IMAGETYPE_PNG) {
            $type = 'png';
        }
     
        return $type;
    }
    Trying to access an array index directly on the functioncall does not seem to do well with my PHP version:
    PHP 5.3.10-1ubuntu3.6 with Suhosin-Patch (cli) (built: Mar 11 2013 14:31:48)
    Copyright (c) 1997-2012 The PHP Group
    Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
        with Xdebug v2.2.1, Copyright (c) 2002-2012, by Derick Rethans
    An easy fix is to change the function to the following:
    function getImageType($filename) {
        $type = getimagesize($filename);
     
        if ($type[2] == IMAGETYPE_JPEG) {
            $type = 'jpeg';
        } elseif ($type[2] == IMAGETYPE_GIF) {
            $type = 'gif';
        } elseif ($type[2] == IMAGETYPE_PNG) {
            $type = 'png';
        }
     
        return $type;
    }
    Hope that helps someone... :)
  2. Alex Gyoshev
    Admin
    Alex Gyoshev avatar
    2500 posts

    Posted 08 Apr 2013 Link to this post

    Hello Rinck,

    Thank you for the feedback! We have fixed the problem, so the next internal build will feature this. I updated your Telerik points as a small token of gratitude.

    All the best,
    Alex Gyoshev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. UI for ASP.NET AJAX banner
Back to Top