leeming Posted August 5, 2006 Share Posted August 5, 2006 *edit* ive located the error, read down to my later postshey, im asking for help with this function, as i dont have much experiance with it... i am looking after a site of a friends while he is away... and this image was working (and has been working) for ages.. but just the other day, it decided to give the red X (for ie)...so with this, im trying to edit the code a little... but it isnt fixing any thing (im trying to get it to save to a file, insead of just ouputting it stright away)this is what i have[code]$mapid= "map".$numb.".png";imagepng ($im, $mapid);[/code]$numb, been a number between 1 and 7, for 7 different maps. so:map1.pngmap2.pngmap3.png... etcbut that code isnt saving to the file as im trying to do... any reasons why? Quote Link to comment https://forums.phpfreaks.com/topic/16641-fixed/ Share on other sites More sharing options...
ignace Posted August 5, 2006 Share Posted August 5, 2006 imagepng(); returns a boolean value, check what you get whenever you put it in an if/else statement[code=php:0]$mapid = "map".$numb.".png";if (imagepng($im, $mapid)) { // should have been written to file.} else { // not working}[/code]if this is not working, then please post the full code, so we can have an in-depth view. Quote Link to comment https://forums.phpfreaks.com/topic/16641-fixed/#findComment-69810 Share on other sites More sharing options...
leeming Posted August 5, 2006 Author Share Posted August 5, 2006 [quote author=ignace link=topic=103088.msg410223#msg410223 date=1154789813]imagepng(); returns a boolean value, check what you get whenever you put it in an if/else statement[code=php:0]$mapid = "map".$numb.".png";if (imagepng($im, $mapid)) { // should have been written to file.} else { // not working}[/code]if this is not working, then please post the full code, so we can have an in-depth view.[/quote]well posting the whole code would be quite confusing.. but... i did test to see if the code was all running, by placing "print" tags, to see if its getting to that line....found out it was this line stopping the script..[code]$im = @imagecreatefrompng ("./worldmap.png") or die ("Cannot Initialize new GD image stream");[/code]so i took off the "@", to see the error (dont know why the or die wasnt working?)i get this message...[quote]Fatal error: Call to undefined function: imagecreatefrompng() in [i]<dir>[/i] on line 8[/quote]i double checked by copy and pasting the function, into php.net, and yes it is spelt right... then i checked the php version.. and yes, i belive its valid for the php version (it has always ran before)...any suggestions now? Quote Link to comment https://forums.phpfreaks.com/topic/16641-fixed/#findComment-69817 Share on other sites More sharing options...
ignace Posted August 5, 2006 Share Posted August 5, 2006 I am not using the GD library, so my help is limited, sorry, but I think the error code is quite clear, and that it ran before, sure, but that also had the @-sign in front of it, not? However "./worldmap.png" bothers me, try changing it to just "worldmap.png" and see what comes up!I had this problem once with defined(); however the problem lay in one of my classes, what the actual cause was of the problem I can't remember! I don't even remember if it now was the class that was the problem or the class that solved it... Quote Link to comment https://forums.phpfreaks.com/topic/16641-fixed/#findComment-69820 Share on other sites More sharing options...
leeming Posted August 5, 2006 Author Share Posted August 5, 2006 [quote author=ignace link=topic=103088.msg410234#msg410234 date=1154791133]I am not using the GD library, so my help is limited, sorry, but I think the error code is quite clear, and that it ran before, sure, but that also had the @-sign in front of it, not? However "./worldmap.png" bothers me, try changing it to just "worldmap.png" and see what comes up!I had this problem once with defined(); however the problem lay in one of my classes, what the actual cause was of the problem I can't remember![/quote]oh sorry, forgot to mention i tried "worldmap.png" and "./worldmap.png" (thats what it was orginaly)... and no diference...i just looked up (copy paste) the error message onto google... [quote]If this error happens (mostly in the pixel selection) your GD library is not up-to-date or not installed fully. To create and read PNG images, the GD library supports normally the function imagecreatefrompng(). If not, your GD library is not complete.hand.jpgPlease ask your provider regarding this issue and ask him to add the PNG support to the GD library of PHP. He will do this. Afterwards, the error will not shown again.[/quote]if there any way apart from the server admin changing things... for this error to show?... if not, i will have to bug the server admin, to ask if hes messed around with the GD library Quote Link to comment https://forums.phpfreaks.com/topic/16641-fixed/#findComment-69824 Share on other sites More sharing options...
leeming Posted August 5, 2006 Author Share Posted August 5, 2006 this is relaly weird....[code]print"SORRY DEBUGGING...DONT BELIVE THE MAP!<BR><BR>"; $im = @imagecreatefrompng("worldmap.png"); /* Attempt to open */ if (!$im) { die('doesnt'); } else { die('works'); }[/code]it out puts...[quote]SORRY DEBUGGING...DONT BELIVE THE MAP![/quote]no "die" comment!?.... Quote Link to comment https://forums.phpfreaks.com/topic/16641-fixed/#findComment-69828 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.