PHP getimagesize some funny issues :)

Discussion in 'PHP' started by HungryMindz, Aug 7, 2013.

  1. #1
    Hi,

    I'm facing some php funny issues while im getting image sizes from php.
    These are my codes:

    Javascript getimagesize sample code:
    <html>
    <body>
    <script>
    // landscape
    var l = new Image();
    l.onload = function()
    {
        alert('landscape: width ( ' + this.width + 'px ), height ( ' + this.height + 'px )');
    }
    l.src = 'landscape.jpg';
    
    // portrait
    var p = new Image();
    p.onload = function()
    {
        alert('portrait: width ( ' + this.width + 'px ), height ( ' + this.height + 'px )');
    }
    p.src = 'portrait.jpg';
    </script>
    </body>
    </html>
    HTML:
    PHP getimagesize sample code:

    <?php
    list($wl, $hl) = getimagesize('landscape.jpg');
    list($wp, $hp) = getimagesize('portrait.jpg');
    print "<p>landscape: width( " . $wl . "px ), ( " . $hl . "px )</p>";
    print "<p>portrait: width( " . $wp . "px ), ( " . $hp . "px )</p>";
    ?>
    PHP:
    Please Find Attached Simple Sample Code:
    http://www.muhammadsameer.com/projects/php_getimagesize/watermarks.rar

    Please Check Attached Images For Help:
    I've described in detail everything in this IMAGE.
    http://www.muhammadsameer.com/projects/php_getimagesize/issue-getimagesize.jpg
    http://www.muhammadsameer.com/projects/php_getimagesize/thumb-getimagesize.jpg
     
    HungryMindz, Aug 7, 2013 IP
  2. C. Berntsen

    C. Berntsen Active Member

    Messages:
    128
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    55
    #2
    The images you provided was both 5184x3456, I don't see the problem? PHP reads horizontal pixels as width, and vertical pixels as height regardless of what angle you took your picture from.
     
    C. Berntsen, Aug 7, 2013 IP
  3. HungryMindz

    HungryMindz Member

    Messages:
    7
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    38
    #3
    PHP is getting CAMERA PORTRAIT picture dimensions same as LANDSCAPE dimensions.
     
    HungryMindz, Aug 12, 2013 IP
  4. EmmanuelFlossie

    EmmanuelFlossie Active Member

    Messages:
    159
    Likes Received:
    11
    Best Answers:
    2
    Trophy Points:
    65
    #4
    I have had the same issues with php not getting the right dimensions. I have disbanded this method and simply did not use it at all anymore.
     
    EmmanuelFlossie, Aug 12, 2013 IP
  5. HungryMindz

    HungryMindz Member

    Messages:
    7
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    38
    #5
    My problem is now solved :)
    Try this thread.
    http://w3schools.invisionzone.com/index.php?showtopic=48241
     
    HungryMindz, Aug 12, 2013 IP
    EmmanuelFlossie likes this.