Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

--TEST-- Test getimagesize() function : basic functionality --FILE-- <?php $imagetype_file..

Decoded Output download

*** Testing getimagesize() : basic functionality ***

-- 200x100.gif (200x100.gif) --

Did this file decode correctly?

Original Code

--TEST--
Test getimagesize() function : basic functionality
--FILE--
<?php
$imagetype_filenames = array(
      // GIF file
      "GIF image file" => "200x100.gif",

      //JPEG file
      "JPEG image file" => "200x100.jpg",

      //PNG file
      "PNG image file" => "200x100.png",

      //SWF file
      "SWF image file" => "200x100.swf",

      //BMP file
      "BMP image file" => "200x100.bmp",

      //TIFF intel byte order
      "TIFF intel byte order image file" => "200x100.tiff",

      //JPC file
      "JPC image file" => "test1pix.jpc",

      //JP2 file
      "JP2 image file" => "test1pix.jp2",

      //IFF file
      "IFF image file" => "test4pix.iff"
);

echo "*** Testing getimagesize() : basic functionality ***\n";

// loop through each element of the array for imagetype
foreach($imagetype_filenames as $key => $filename) {
      echo "\n-- $key ($filename) --\n";
      var_dump( getimagesize(__DIR__."/$filename", $info) );
      var_dump( $info );
};
?>
--EXPECTF--
*** Testing getimagesize() : basic functionality ***

-- GIF image file (200x100.gif) --
array(7) {
  [0]=>
  int(200)
  [1]=>
  int(100)
  [2]=>
  int(1)
  [3]=>
  string(24) "width="200" height="100""
  ["bits"]=>
  int(8)
  ["channels"]=>
  int(3)
  ["mime"]=>
  string(9) "image/gif"
}
array(0) {
}

-- JPEG image file (200x100.jpg) --
array(7) {
  [0]=>
  int(200)
  [1]=>
  int(100)
  [2]=>
  int(2)
  [3]=>
  string(24) "width="200" height="100""
  ["bits"]=>
  int(8)
  ["channels"]=>
  int(3)
  ["mime"]=>
  string(10) "image/jpeg"
}
array(1) {
  ["APP0"]=>
  string(%d)%s
}

-- PNG image file (200x100.png) --
array(6) {
  [0]=>
  int(200)
  [1]=>
  int(100)
  [2]=>
  int(3)
  [3]=>
  string(24) "width="200" height="100""
  ["bits"]=>
  int(8)
  ["mime"]=>
  string(9) "image/png"
}
array(0) {
}

-- SWF image file (200x100.swf) --
array(5) {
  [0]=>
  int(200)
  [1]=>
  int(100)
  [2]=>
  int(4)
  [3]=>
  string(24) "width="200" height="100""
  ["mime"]=>
  string(29) "application/x-shockwave-flash"
}
array(0) {
}

-- BMP image file (200x100.bmp) --
array(6) {
  [0]=>
  int(200)
  [1]=>
  int(100)
  [2]=>
  int(6)
  [3]=>
  string(24) "width="200" height="100""
  ["bits"]=>
  int(24)
  ["mime"]=>
  string(9) "image/bmp"
}
array(0) {
}

-- TIFF intel byte order image file (200x100.tiff) --
array(5) {
  [0]=>
  int(200)
  [1]=>
  int(100)
  [2]=>
  int(7)
  [3]=>
  string(24) "width="200" height="100""
  ["mime"]=>
  string(10) "image/tiff"
}
array(0) {
}

-- JPC image file (test1pix.jpc) --
array(7) {
  [0]=>
  int(1)
  [1]=>
  int(1)
  [2]=>
  int(9)
  [3]=>
  string(20) "width="1" height="1""
  ["bits"]=>
  int(8)
  ["channels"]=>
  int(3)
  ["mime"]=>
  string(24) "application/octet-stream"
}
array(0) {
}

-- JP2 image file (test1pix.jp2) --
array(7) {
  [0]=>
  int(1)
  [1]=>
  int(1)
  [2]=>
  int(10)
  [3]=>
  string(20) "width="1" height="1""
  ["bits"]=>
  int(8)
  ["channels"]=>
  int(3)
  ["mime"]=>
  string(9) "image/jp2"
}
array(0) {
}

-- IFF image file (test4pix.iff) --
array(6) {
  [0]=>
  int(4)
  [1]=>
  int(1)
  [2]=>
  int(14)
  [3]=>
  string(20) "width="4" height="1""
  ["bits"]=>
  int(4)
  ["mime"]=>
  string(9) "image/iff"
}
array(0) {
}

Function Calls

None

Variables

$key 200x100.gif
$filename 200x100.gif
$imagetype_filenames [{'key': 'GIF image file', 'value': '200x100.gif'}, {'key': 'JPEG image file', 'value': '200x100.jpg'}, {'key': 'PNG image file', 'value': '200x100.png'}, {'key': 'SWF image file', 'value': '200x100.swf'}, {'key': 'BMP image file', 'value': '200x100.bmp'}, {'key': 'TIFF intel byte order image file', 'value': '200x100.tiff'}, {'key': 'JPC image file', 'value': 'test1pix.jpc'}, {'key': 'JP2 image file', 'value': 'test1pix.jp2'}, {'key': 'IFF image file', 'value': 'test4pix.iff'}]

Stats

MD5 012977b3bc96c6653e97b1f27d8f1482
Eval Count 0
Decode Time 100 ms