[Qgis-user] Including Images in Print Composer Templates

Bernhard Ströbl bernhard.stroebl at jena.de
Thu Jan 28 01:43:43 PST 2016


Hi,

this is not an answer to your question but what I do is to load images 
with an URL pointing to one of our internal web servers. This works 
perfectly in templates being loaded on different machines with different 
OS, too.

Bernhard

Am 27.01.2016 um 00:25 schrieb David A. Riggs:
> 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
>
>
>
> 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 <mailto:david.a.riggs at gmail.com>>
>
>
>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user
>



__________ Information from ESET Mail Security, version of virus signature database 12938 (20160128) __________

The message was checked by ESET Mail Security.
http://www.eset.com





More information about the Qgis-user mailing list