0

I used the getimagesize() to get the size of an .swf file on my xampp localhost server and it worked. But when I apply it on my site. It doesn't output anything.

So I made a test page to see if it would react the same way and it did. I echo the width only just to see if it gets any result at all, and on my localhost, it gives me the output of 800. But when I use it on my site, it gives no output at all...

<?php

 $url= "http://cache.armorgames.com/files/games/sugar-sugar-3-17769.swf"; 
 $tst = getimagesize($url);
 echo $tst[0];

?>

Is there a reason why it probably wouldn't work? It makes no sense to me.

bumble_bee_tuna
  • 3,533
  • 7
  • 43
  • 83
TheGodProject
  • 147
  • 2
  • 12
  • possible duplicate of [PHP getimagesize() not working](http://stackoverflow.com/questions/25230949/php-getimagesize-not-working) – mim. Jul 17 '15 at 23:22

2 Answers2

0

I wrote out a blank php file and used getimagesize() on the url you posted and it returned the expected array of results. How you looked at your php error log to see if there are any other underlying errors that are preventing output? Does print_r() or var_dump() give anything?

  Array
(
    [0] => 800
    [1] => 600
    [2] => 13
    [3] => width="800" height="600"
    [mime] => application/x-shockwave-flash
)
Aetiranos
  • 329
  • 1
  • 6
  • print_r($tst) gives me nothing. But var_dump($tst) gives me bool(false). So I'm guessing something must be disabled but not sure what... – TheGodProject Jul 17 '15 at 23:50
  • I found this on php.net - its worth a try... [link](http://us1.php.net/manual/en/function.getimagesize.php#88793) – Aetiranos Jul 18 '15 at 00:09
  • I found out the problem. allow_url_fopen was disabled in my php.ini. I was able to contact my web provider and enable it and then it worked. Thanks for the help. – TheGodProject Jul 18 '15 at 02:43
0

Try this.

<?php
$filename='http://samples.mplayerhq.hu/SWF/test.swf';
list($width, $height, $type, $attr) = getimagesize($filename);
echo $width;
 ?>