Jump to content


Photo

*fixed*


  • Please log in to reply
5 replies to this topic

#1 leeming

leeming
  • Members
  • PipPipPip
  • Advanced Member
  • 93 posts

Posted 05 August 2006 - 02:51 PM

*edit* ive located the error, read down to my later posts



hey, 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

$mapid= "map".$numb.".png";

imagepng ($im, $mapid);

$numb, been a number between 1 and 7, for 7 different maps. so:
map1.png
map2.png
map3.png
... etc

but that code isnt saving to the file as im trying to do... any reasons why?
Im not perfect ;) lol

#2 ignace

ignace
  • Moderators
  • Now mod flavored
  • 6,430 posts
  • LocationBelgium

Posted 05 August 2006 - 02:56 PM

imagepng(); returns a boolean value, check what you get whenever you put it in an if/else statement

$mapid = "map".$numb.".png";
if (imagepng($im, $mapid)) {
  // should have been written to file.
} else {
   // not working
}

if this is not working, then please post the full code, so we can have an in-depth view.

#3 leeming

leeming
  • Members
  • PipPipPip
  • Advanced Member
  • 93 posts

Posted 05 August 2006 - 03:09 PM

imagepng(); returns a boolean value, check what you get whenever you put it in an if/else statement

$mapid = "map".$numb.".png";
if (imagepng($im, $mapid)) {
  // should have been written to file.
} else {
   // not working
}

if this is not working, then please post the full code, so we can have an in-depth view.


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..

$im = @imagecreatefrompng ("./worldmap.png") or die ("Cannot Initialize new GD image stream");

so i took off the "@", to see the error (dont know why the or die wasnt working?)

i get this message...

Fatal error: Call to undefined function: imagecreatefrompng() in <dir> on line 8


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?
Im not perfect ;) lol

#4 ignace

ignace
  • Moderators
  • Now mod flavored
  • 6,430 posts
  • LocationBelgium

Posted 05 August 2006 - 03:18 PM

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...

#5 leeming

leeming
  • Members
  • PipPipPip
  • Advanced Member
  • 93 posts

Posted 05 August 2006 - 03:24 PM

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!


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...

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.


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
Im not perfect ;) lol

#6 leeming

leeming
  • Members
  • PipPipPip
  • Advanced Member
  • 93 posts

Posted 05 August 2006 - 03:37 PM

this is relaly weird....

print"SORRY DEBUGGING...DONT BELIVE THE MAP!<BR><BR>";



   $im = @imagecreatefrompng("worldmap.png"); /* Attempt to open */
   if (!$im)
   {
       die('doesnt');
   }
   else
   {
     die('works');
   }


it out puts...

SORRY DEBUGGING...DONT BELIVE THE MAP!



no "die" comment!?....
Im not perfect ;) lol




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users