Gutspiller Posted March 11, 2010 Share Posted March 11, 2010 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! Quote Link to comment https://forums.phpfreaks.com/topic/194949-warning-getimagesize-and-warning-division-by-zero-errors-please-help/ Share on other sites More sharing options...
sasa Posted March 12, 2010 Share Posted March 12, 2010 you try to open NOT exist picture and resize it check that file exist Quote Link to comment https://forums.phpfreaks.com/topic/194949-warning-getimagesize-and-warning-division-by-zero-errors-please-help/#findComment-1025063 Share on other sites More sharing options...
PravinS Posted March 12, 2010 Share Posted March 12, 2010 getimagesize get size of the image, not of swf file. Quote Link to comment https://forums.phpfreaks.com/topic/194949-warning-getimagesize-and-warning-division-by-zero-errors-please-help/#findComment-1025065 Share on other sites More sharing options...
Gutspiller Posted March 12, 2010 Author Share Posted March 12, 2010 1. File is there, check the link I posted, despite users getting errors on pages, where game file is. 2. getimagesize does, and has always worked with the site. A site that ONLY uses .swf files. Other ideas? Quote Link to comment https://forums.phpfreaks.com/topic/194949-warning-getimagesize-and-warning-division-by-zero-errors-please-help/#findComment-1025151 Share on other sites More sharing options...
MadTechie Posted March 12, 2010 Share Posted March 12, 2010 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 } Quote Link to comment https://forums.phpfreaks.com/topic/194949-warning-getimagesize-and-warning-division-by-zero-errors-please-help/#findComment-1025179 Share on other sites More sharing options...
Gutspiller Posted March 12, 2010 Author Share Posted March 12, 2010 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! Quote Link to comment https://forums.phpfreaks.com/topic/194949-warning-getimagesize-and-warning-division-by-zero-errors-please-help/#findComment-1025277 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.