|Graphics and figures / Image file formats|
Image files should be stored separately from topic files. Images can be re-used by referencing the same file name, by conref to an image element, or by conref to a fig element.
Although there is no technical reason for taking this approach, you should store image files in a separate folder from content topics, for ease of organisation and file management. Use a consistent folder name for images, typically /images.
<concept> ... <img href="../images/ej25.png" width="480px" height="360px" /> ... </concept> <task> ... <img href="../images/ej25.png" width="480px" height="360px" /> ... </task>
<concept id="concept_engines"> ... <img id="img_ej25_engine" href="../images/ej25.png" width="480px" height="360px" /> ... </concept> <task> ... <img conref="#concept_engines/img_ej25_engine" href="-dita-use-conref-target" /> ... </task>
Because the href attribute of the image element is mandatory, you must set the value of the href attribute of the referencing image to -dita-use-conref-target.
The conref method has the advantage that attributes are also re-used, reducing some duplication of effort. However, if you deliberately want to have different attributes for different uses of the image, the simple file re-use method can be used.
If you are using figure (fig) structures instead of simple images, you can either conref the image element or the fig element. The method to choose will depend on whether you want to re-use the attributes and elements of the figure element.
In DITA 1.2, you can use the keyref feature to indirectly reference an image or figure, as an alternative to conref.