arash Posted August 11, 2009 Share Posted August 11, 2009 i wrote code bellow , it works on local [tested by easy php] , but there is just no respone on remote , like : http://yahooavatarload.sourceforge.net/?yid=darkeliden code : <?php if (isset($_GET['yid'])) { $id=$_GET['yid']; $fn="http://img.msg.yahoo.com/avatar.php?yids=$id&format=png&width=120&height=120"; $handle = fopen("$fn", "r"); $contents = stream_get_contents($handle); $fp = fopen('avats/'.$id.'.png', 'w'); fwrite($fp, $contents); fclose($fp); // load the image from the file specified: $img="avats\\".$id.".png"; $im = imagecreatefrompng("$img"); // if there's an error, stop processing the page: if(!$im) { die(""); } // define some colours to use with the image $yellow = imagecolorallocate($im, 255, 255, 0); $black = imagecolorallocate($im, 0, 0, 0); // get the width and the height of the image $width = imagesx($im); $height = imagesy($im); // draw a black rectangle across the bottom, say, 20 pixels of the image: imagefilledrectangle($im, 0, ($height-15) , $width, $height, $black); // now we want to write in the centre of the rectangle: $font = 3; // store the int ID of the system font we're using in $font $text = "Y A L - NG"; // store the text we're going to write in $text // calculate the left position of the text: $leftTextPos = ( $width - imagefontwidth($font)*strlen($text) )/2; // finally, write the string: imagestring($im, $font, $leftTextPos, $height-13, $text, $yellow); // output the image // tell the browser what we're sending it Header('Content-type: image/png'); // output the image as a png imagepng($im); // tidy up imagedestroy($im); }else{ echo "NO ID ENTERED"; } ?> Quote Link to comment Share on other sites More sharing options...
WolfRage Posted August 11, 2009 Share Posted August 11, 2009 You told it to die, it is just doing what you told it to. My guess is you do not have permission to write the file you are trying to write. Turn on error reporting and set E_ALL. Quote Link to comment Share on other sites More sharing options...
arash Posted August 11, 2009 Author Share Posted August 11, 2009 s :facewall:till not working, and no error returns Quote Link to comment Share on other sites More sharing options...
WolfRage Posted August 12, 2009 Share Posted August 12, 2009 Instead do a file_put_contents() and wrap it to check and see if it returns false like so: <?php if(file_put_contents('avats/'.$id.'.png',$contents)===FALSE ) { echo 'You are encountering a problem writing to the disk on this server!'; exit; } This will be a definitive answer if it is a write issue, if not then let me know and we will do some more trouble shooting. Quote Link to comment 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.