Nodral Posted June 7, 2011 Share Posted June 7, 2011 Hi I have created the following file to output results from a questionnaire in a visual way. This was working absolutely fine, but now has decided to stop working. All I did was navigate to a different web page. I have tried closing my browser and clearing cache etc but still it won't output to a web page. I get the windows pop-up of 'Open, Save or Cancel' If I chose open, it simply opens the file in notepad. Any ideas? <?php //Create image size and initiate $image=imagecreate(1000,1000); //Allocate colours (1st is always background) $background=imagecolorallocate($image, 255, 255, 255); $white = imagecolorallocate($image, 255, 255, 255); $black = imagecolorallocate($image, 0, 0, 0); $red = imagecolorallocate($image, 255, 0, 0); //array of results $activist=10; $reflector=18; $theorist=17; $pragmatist=9; //set zeros for x & y $x=500; $y=500; //change results into coordinates $values=array( $x, $y-($activist*20), $x+($reflector*20), $y, $x, $y+($theorist*20), $x-($pragmatist*20), $y); //create vertices //x axis imageline($image, 500, 100, 500, 900, $black); //y axis imageline($image, 100, 500, 900, 500, $black); // create picture imagefilledpolygon($image, $values, 4, $black); //change to outline //add titles // Path to our ttf font file $font_file = 'arial.ttf'; //create labels for axis imagefttext($image, 20, 0, 450,50,$black, 'arial.ttf',"Activist" ); imagefttext($image, 20, 0, 450,950,$black, 'arial.ttf',"Theorist" ); imagefttext($image, 20, 90, 50,550,$black, 'arial.ttf',"Pragmatist" ); imagefttext($image, 20, 90, 950,550,$black, 'arial.ttf',"Reflector" ); //create labels for co-ordinates imagefttext($image, 20, 0, $x, $y-($activist*20)-50,$red, 'arial.ttf',"$activist" ); imagefttext($image, 20, 0, $x, $y+($theorist*20)+50,$red, 'arial.ttf',"$theorist" ); imagefttext($image, 20, 0, $x-($pragmatist*20)-50,$y,$red, 'arial.ttf',"$pragmatist" ); imagefttext($image, 20, 0, $x+($reflector*20)+50,$y,$red, 'arial.ttf',"$reflector" ); //set header header("content-type:image.png"); //produce image imagepng($image); ?> Link to comment https://forums.phpfreaks.com/topic/238652-drawing-file-suddenly-not-working/ Share on other sites More sharing options...
teynon Posted June 7, 2011 Share Posted June 7, 2011 header('Content-Type: image/png'); Link to comment https://forums.phpfreaks.com/topic/238652-drawing-file-suddenly-not-working/#findComment-1226390 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.