Difference between revisions of "StaticImages"

From WeBWorK_wiki
Jump to navigation Jump to search
m
Line 22: Line 22:
 
<td style="background-color:#ffcccc;padding:7px;">
 
<td style="background-color:#ffcccc;padding:7px;">
 
<p>
 
<p>
Here it's easy: we just use the <code>image</code> macro in the text section of the problem to include the image. The image to be included should be a GIF or a PNG file and be located in the same directory as the PG problem file under the course <code>templates</code> directory. (When the alias() command in dangerousMacros.pl is rewritten in the future, support for JPG, PDF, and SWF files should become available.)
+
Here it's easy: we just use the <code>image</code> macro in the text section of the problem to include the image. The image to be included should be a GIF or a PNG file and be located in the same directory as the PG problem file under the course <code>templates</code> directory. (When the alias() command in dangerousMacros.pl is rewritten in the future, support for JPG, PDF, and SWF files should become available.) The name of the image file must have only one period in it (imagename.gif works but image.name.gif does not) in order for pdf generation to work properly.
 
</p>
 
</p>
 
<p>
 
<p>

Revision as of 00:20, 4 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.

Problem Techniques Index

PG problem file Explanation
  BEGIN_TEXT
  \{ image( "imagename.png" ) \}
  END_TEXT

Here it's easy: we just use the image macro in the text section of the problem to include the image. The image to be included should be a GIF or a PNG file and be located in the same directory as the PG problem file under the course templates directory. (When the alias() command in dangerousMacros.pl is rewritten in the future, support for JPG, PDF, and SWF files should become available.) The name of the image file must have only one period in it (imagename.gif works but image.name.gif does not) in order for pdf generation to work properly.

We can, of course, include options such as specifying the tex_size, etc., in this call, as shown in the including dynamic images code snippet.

Problem Techniques Index