Forum archive 2000-2006

John Jones - images in system images directory

John Jones - images in system images directory

by Arnold Pizer -
Number of replies: 0
inactiveTopicimages in system images directory topic started 11/8/2002; 6:00:05 PM
last post 11/12/2002; 2:51:46 PM
userJohn Jones - images in system images directory  blueArrow
11/8/2002; 6:00:05 PM (reads: 1123, responses: 5)
Can a problem file access an image in system_html/images in a portable way (aside from hard-coding the url/path to that directory)?

John

<| Post or View Comments |>


userArnold K. Pizer - Re: images in system images directory  blueArrow
11/11/2002; 2:39:22 AM (reads: 1291, responses: 0)
Hi John,

I'm not sure if this is what you have in mind, but you could add this to the environment. Just put

$PG_environment{'imagesURL'} = $imagesURL;

in the webworkCourse.ph file. Then in problem .pg files, the variable $envir{'imagesURL'} will be "system_html/images"

Arnie

<| Post or View Comments |>


userJohn Jones - Re: images in system images directory  blueArrow
11/12/2002; 5:15:25 AM (reads: 1317, responses: 0)
Hi Arnie,

The question was motivated by making the matrix command I asked about in another thread. In image modes, it could generate images of the sides of the matricies as it goes, but I was thinking about having static images of sides in different sizes ready to go. This would work if there was a system-wide places where images are located which could be accessed from a problem.

John

<| Post or View Comments |>


userArnold K. Pizer - Re: images in system images directory  blueArrow
11/12/2002; 6:24:36 AM (reads: 1293, responses: 0)
Hi John,

I assume that you want a macro to be able to locate the images of the sides of the matrices. $Global::imagesURL will point to the directory .../webwork/system_html/images/ in recent versions of WeBWorK (aside --- I think I want to move this back to its older location .../webwork/system/system_html/images/ so that it's easy to keep images coordinated with WeBWorK versions).

Setting $PG_environment{'imagesURL'} = $imagesURL; is just a way to make this available to problem authors, but that doesn't seem to be what you need.

Arnie

<| Post or View Comments |>


userJohn Jones - Re: images in system images directory  blueArrow
11/12/2002; 10:30:08 AM (reads: 1284, responses: 0)
Hi Arnie,

I was thinking of the matrix thing as ultimately going into the standard WeBWorK, so the images should be accessible without special customizing. For that, imagesURL would have to be available to the macro. It looks like the proper way to do that is to introduce it to the problem environment in processProblem8.pl, where other urls and directories get passed to the problem. Would that be ok?

John

<| Post or View Comments |>


userMichael Gage - Re: images in system images directory  blueArrow
11/12/2002; 2:51:46 PM (reads: 1316, responses: 0)
Hi John,

We can do that, but for now, while things are being stabilized, adding it to the webworkCourse.ph file is an easy way to make the URL available without changing the core of the code base.

It's also pretty easy to transmit to others that want to try it:

As Arnie describes above:

Add the line:

$PG_environment{'systemImagesURL'} = $imagesURL;

to webworkCourse.ph near the bottom.

Then within your macros file use:

$main::systemImagesURL to get the value of this variable.

(For examples see the

$PG_environment{PROBLEM_GRADER_TO_USE} = 'avg_problem_grader';

line or the line

$PG_environment{'PRINT_FILE_NAMES_FOR'} = ['apizer','gage'];

which are already in the webworkCourse.ph file, possibly commented out.

This also allows for the possibility that systemImageURL could be customized on a course by course basis.

One other nice thing about this mechanism is that it allows you to add environment variables to your course (or your development course) while insuring that you can't conflict with anyone else's course running on the same system.

-- Mike

<| Post or View Comments |>