Difference between revisions of "StaticImages"
m |
m |
||
Line 29: | Line 29: | ||
</p> |
</p> |
||
<p> |
<p> |
||
− | For each PG problem with static images, you should put both the PG file and the image files into their own separate subdirectory. This subdirectory should be located somewhere under the course <code>templates</code> directory. |
||
+ | For each PG problem with static images, you should put both the PG file and the image files into their own separate subdirectory. This subdirectory should be located somewhere under the course <code>templates</code> directory and have the same root name as the PG file. For example, if you have a PG file called <code>Contour-plots.pg</code> which uses static graphic files <code>Contour-plot-01.gif</code> and <code>Contour-plot-02.gif</code>, you should create a subdirectory of the course <code>templates</code> directory called <code>Contour-plots</code> and put the PG file and all the GIF files in it. Putting a PG file and all of its graphics files into their own separate subdirectory like this makes it easier to find the graphics files that go with each PG file, thereby making the problem easier to maintain. The library browser in WeBWorK is configured to recognize that when a subdirectory has the same name as the root name of the only PG file in that subdirectory, the subdirectory and PG file should be treated as a single entity for the purpose of browsing the library via directories. |
||
</p> |
</p> |
||
<p> |
<p> |
Revision as of 23:14, 10 November 2009
Static Graphic Images: PG Code Snippet
This code snippet shows the essential PG code to insert a static (pre-generated) graphic image into a problem. Note that these are insertions, not a complete PG file. This code will have to be incorporated into the problem file on which you are working.
PG problem file | Explanation |
---|---|
BEGIN_TEXT \{ image( "imagename.png" ) \} \{ image( "imagename.png", width=>150, height=>150, tex_size=>250, extra_html_tags=>'alt="Graph of a function."' ) \} END_TEXT |
Here it's easy: we just use the
For each PG problem with static images, you should put both the PG file and the image files into their own separate subdirectory. This subdirectory should be located somewhere under the course
We can, of course, include options such as specifying the (When the alias() command in dangerousMacros.pl is rewritten in the future, support for JPG, PDF, and SWF files should become available.) |