32.1 Locating graphics files for HTML

For standard HTML output to be viewed with a browser, you can place graphics files in the same directory as the HTML files, or in any other directory relative to that directory. For other HTML output types, graphics placement is restricted:

Graphics in directory with HTML files

If graphics are in the same directory as the HTML files, references to those graphics via <img> tags do not need a path component, and whatever path information is already present in DITA must be removed.

To remove path information from graphics file names:

[Graphics]
; StripGraphPath = No (default)
;  or Yes (remove path from referenced graphics)
StripGraphPath = Yes

When StripGraphPath=Yes, DITA2Go omits any path information from references in generated <img> tags.

Graphics in a different directory

If graphics will be in a directory different from the directory for HTML files, you must specify the path from the HTML files to the graphics directory, so DITA2Go can include the path in the generated <img> tags.

To specify where a browser (or Help viewer) should look for graphics:

[Graphics]
; GraphPath = path to use (replacing any previous) for all graphics
GraphPath = path/to/graphics/files

GraphPath specifies the location of graphics files relative to the location of HTML files. For Web-hosted systems, GraphPath must be the path to the graphics on the Web server, which might be different from the file path on the conversion system. Although you can specify an absolute path, relative is almost always what you want.

Note:  Absolute paths do not work if the graphics are on a UNIX server. 

Default path

The default value of GraphPath is the directory designated by [Automation]WrapPath (see §44.6 Assembling files for distribution); if WrapPath is not specified, the default is the project directory. For JavaHelp and Oracle Help only, the default value of GraphPath is the directory designated by [JavaHelpOptions]GraphSubdir, prefixed with “../”. See §20.3.6.2 Letting DITA2Go set up the directory structure and copy files.

If you do not specify a value for GraphPath, the value of StripGraphPath determines whether DITA2Go includes the original path from your DITA document, or no path at all, in generated <img> tags.

GraphPath does not move files!

In HTML references to images, the GraphPath setting prefixes the path specified by GraphPath to the name of each graphics file, in place of whatever other path was there in your DITA document. This option sets the src attribute of the <img> tags; it does not change the location of the graphics files themselves. You must either copy the graphics files to their specified location, or have DITA2Go copy them for you. See §44.7.1 Copying referenced graphics to a distribution directory.

See also:

§44.7 Placing graphics files for distribution

§18.3.9 Locating graphics files for HTML Help

§19.3.8 Getting OmniHelp supporting files in the right place

§20.3.6.3 Locating graphics files for JavaHelp and Oracle Help

§40.2.1.1 Specifying graphics location for HTML

Previous Topic:  32. Including graphics in HTML

Next Topic:  32.2 Specifying options for HTML graphics

Parent Topic:  32. Including graphics in HTML

Sibling Topics:

32.2 Specifying options for HTML graphics

32.3 Omitting graphics from HTML output

32.4 Selecting and modifying graphics

32.5 Positioning graphics in HTML output

32.6 Specifying HTML image attributes

32.7 Providing (or omitting) alternate text for images

32.8 Scaling images for HTML

32.9 Creating image maps for HTML

32.10 Supplying a background image or watermark

Table of ContentsIndex