Jump to content

"Warning: getimagesize" and "Warning: Division by zero" errors. - please help!


Gutspiller

Recommended Posts

I have users complaining that my site is giving the following error. (though I have not experienced them)

 

Warning: getimagesize(./swf/Matter Shift_march_10th_2010.swf ) [function.getimagesize]: failed to open stream: No such file or directory in/home/games4w/public_html/games/system.class.php on line 430

 

Warning: Division by zero in /home/games4w/public_html/games/system.class.php on line 519

 

Warning: Division by zero in /home/games4w/public_html/games/system.class.php on line 520

 

I am hoping to find a solution to the problem. The actual page that these errors are coming from are http://www.gamesforwork.com/games/play-14719-Matter_Shift-Flash_Game

 

I am not very much of a programmer. These are the lines that are referred to in that error:

 

430            list($imagewidth, $imageheight, $itype, $iattr, $imime) = getimagesize($this->swfdir."/".$game['game_swf']);

 

519                    $imagewidth = $imagewidth / $div;

 

520                    $imageheight = $imageheight / $div;

 

 

Can anybody please help me find a solution to these errors? I am not a programmer, but I can insert code and ask my host to change server configurations if they need to be.

 

Thank you!

 

Link to comment
Share on other sites

It would seam that $this->swfdir has a value of . and that would suggest the current folder your script its running from, so as sasa said, your trying to open a file that doesn't exist, (that the location you provided)

making the assumption the game is in the /home/games4w/public_html/games/swf folder try something like this this

 

430:

$this->swfdir = dirname(__FILE__)."/swf"; //set path to this fiels path + swf
$gameFile = $this->swfdir."/".$game['game_swf']; //build game file path
if(file_exists($gameFile )){ //check exists
    list($imagewidth, $imageheight, $itype, $iattr, $imime) = getimagesize($gameFile); //get height/width
}else{
    die("$gameFile: not found"); //error report
}

Link to comment
Share on other sites

Hi  MadTechie,

 

Are you saying I should replace my entire line 430 with the exact code you posted?

 

One thing that has me a little concerned is that I am not getting the error myself, but users are reporting it, so I would have to publish the code, and then contact them to get them to test it.

 

If you can tell me what code to replace specifically though, I am certainly willing to try.

 

Should I post some more lines of code around line 430?

 

Thanks for the code snippet MadTechie!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.