Forum archive 2000-2006

Bjorn Nelson - $graph->draw not drawing

Bjorn Nelson - $graph->draw not drawing

by Arnold Pizer -
Number of replies: 0
inactiveTopic$graph->draw not drawing topic started 9/24/2004; 2:45:01 PM
last post 1/6/2005; 4:26:31 PM
userBjorn Nelson - $graph->draw not drawing  blueArrow
9/24/2004; 2:45:01 PM (reads: 1150, responses: 2)
I am having a weird problem. insertGraph isn't working. It creates an empty png file but doesn't make the graph. There are now errors as well. Equations are working fine.

The example page we are using has two graphs. When click on the problem to load the page. I get the generic error (Safari is my browser):

Safari canât open the page âhttp://servername/webwork2/COURSEID/Final_Exam_Review_VII/1â¦O2hNhbU1XQ8CDg&user=Professor&effectiveUser=Professorâ because it could not load any data from this location.

it does this three times (or until it makes three empty png's) and then it loads the page with the empy images.

I tried to do some debugging and this is as far as I got:

[modified dangerousMacros.pl] sub insertGraph { # Convert the image to GIF and print it on standard output my $graph = shift; my $extension = ($WWPlot::use_png) ? '.png' : '.gif'; my $fileName = $graph->imageName . $extension; my $filePath = convertPath("gif/$fileName"); $filePath = &surePathToTmpFile( $filePath ); # Check to see if we already have this graph, or if we have to make it warn("$0",testing,""); my $filePathlog = $filePath . ".log"; local(*OUTPUTLOG); # create local file handle so it won't overwrite other open files. open(OUTPUTLOG, ">$filePathlog")||warn ("$0","Can't open $filePathlog
",""); print OUTPUTLOG "filepath = $filePath, imagename = ",$graph->imageName , "stat = ", (stat $filePath)[9];

if( not -e $filePath # does it exist? or ((stat "$templateDirectory"."$main::envir{fileName}")[9] > (stat $filePath)[9]) # source has changed or $graph->imageName =~ /Undefined_Set/) { # problems from SetMaker and its ilk should always be redone #createFile($filePath, $main::tmp_file_permission, $main::numericalGroupID); print OUTPUTLOG "\ninside\n"; local(*OUTPUT); # create local file handle so it won't overwrite other open files. open(OUTPUT, ">$filePath")||warn ("$0","Can't open $filePath
",""); chmod( 0777, $filePath); print OUTPUT $graph->draw|| warn("$0","Can't print graph to $filePath
",""); close(OUTPUT)||warn("$0","Can't close $filePath
",""); close(OUTPUTLOG); } $filePath; }

which outputs three testing lines (one for each graph) in the web browser and: filepath = /usr/local/webwork2/courses/COURSEID/html/tmp/gif/professor-463-setFinal_Exam_Review_VIIprob1image1.png, imagename = professor-463- setFinal_Exam_Review_VIIprob1image1stat = inside

in each log file

Let me know if you require any more details. Thanks, Bjorn

bnelson@baruch.cuny.edu

<| Post or View Comments |>


userBjorn Nelson - Re: $graph->draw not drawing  blueArrow
9/24/2004; 2:50:59 PM (reads: 1431, responses: 0)
that code looks really hard to read now. Basically, the modifications I made were to have insertGraph warn testing first. Then it creates a log file and writes the $filePath, $graph0->imageName, (stat $filePath)[9]. Then in the condition it prints "inside" to the log file to verify it passes the condition. Then it closes the Log.

Also, I have been working on the webwork freebsd port some more. Current status is at: http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/71997

-Bjorn

<| Post or View Comments |>


userBjorn Nelson - Re: $graph->draw not drawing  blueArrow
1/6/2005; 4:26:31 PM (reads: 1342, responses: 0)
Figured this out.

There is a conflict if you have php4 with the extension for gd enabled. It causes httpd to crash when it tries to draw an image using gd.

Thanks for helping out, Michael Gage.

-Bjorn

<| Post or View Comments |>