[Qgis-user] Including Images in Print Composer Templates

David A. Riggs david.a.riggs at gmail.com
Tue Jan 26 15:25:13 PST 2016


Hi all,

I'm trying to create a library of themed print composer templates for my
agency, and each needs to include an .SVG logo image. I would like for the
image file to A) either be included within the template file itself, or B)
referenced from a path relative to the template file.

It seems that when saving as a template (QGIS 2.8.3 on Win7), the .QPT file
references the image file as a relative path, but apparently relative to
the project rather than the template. Since I'm trying to distribute these
templates to other users, and I can't predict their filesystem layout, I'm
trying to figure out a way to reference the image relative to the template
itself.


I have tried editing the .QPT source in several ways to make this work:

1.  <ComposerPicture file="logo.svg">

Simply the image filename, with the image in the same directory as the
template. Fails to load with a red X.

2.  <ComposerPicture file="./logo.svg">

Relative path style "current directory" with the image in the same
directory as template. Fails to load because QGIS resolves the path to the
PROJECT dir rather than the template dir.

3. Absolute path to the .SVG image. This works, but I don't know nor want
to dictate where a user places their templates.

4. Relative path to project. This works, and forcing users to store
templates in some fixed location relative to all their projects is a
solution, though not one I want to force on them.


Is there a way to refer to an image file relative to the template itself,
OR a way to include the contents of an .SVG image inside the .QPT template?


Thanks!

- DR

-- 
David A. Riggs <david.a.riggs at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20160126/f6e9dd03/attachment.html>


More information about the Qgis-user mailing list