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-- Compare getimagesize and getimagesizefromstring --FILE-- <?PHP $img = __DIR__ . '..

Decoded Output download

--TEST--
Compare getimagesize and getimagesizefromstring
--FILE--
<?php
$img = __DIR__ . '/test.gif';

$i1 = getimagesize($img);

$data = file_get_contents($img);

$i2 = getimagesizefromstring($data);

var_dump($i1);
var_dump($i2);
?>
--EXPECT--
array(7) {
  [0]=>
  int(120)
  [1]=>
  int(67)
  [2]=>
  int(1)
  [3]=>
  string(23) "width="120" height="67""
  ["bits"]=>
  int(7)
  ["channels"]=>
  int(3)
  ["mime"]=>
  string(9) "image/gif"
}
array(7) {
  [0]=>
  int(120)
  [1]=>
  int(67)
  [2]=>
  int(1)
  [3]=>
  string(23) "width="120" height="67""
  ["bits"]=>
  int(7)
  ["channels"]=>
  int(3)
  ["mime"]=>
  string(9) "image/gif"
}

Did this file decode correctly?

Original Code

--TEST--
Compare getimagesize and getimagesizefromstring
--FILE--
<?PHP
$img = __DIR__ . '/test.gif';

$i1 = getimagesize($img);

$data = file_get_contents($img);

$i2 = getimagesizefromstring($data);

var_dump($i1);
var_dump($i2);
?>
--EXPECT--
array(7) {
  [0]=>
  int(120)
  [1]=>
  int(67)
  [2]=>
  int(1)
  [3]=>
  string(23) "width="120" height="67""
  ["bits"]=>
  int(7)
  ["channels"]=>
  int(3)
  ["mime"]=>
  string(9) "image/gif"
}
array(7) {
  [0]=>
  int(120)
  [1]=>
  int(67)
  [2]=>
  int(1)
  [3]=>
  string(23) "width="120" height="67""
  ["bits"]=>
  int(7)
  ["channels"]=>
  int(3)
  ["mime"]=>
  string(9) "image/gif"
}

Function Calls

None

Variables

None

Stats

MD5 3a23fe7c15dcf022f8b7bbbad4254ead
Eval Count 0
Decode Time 94 ms