Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • suzyb 474 posts 932 karma points
    May 18, 2011 @ 12:28
    suzyb
    0

    Showing an image in a template

    I want to add an image from the media library into my master template.  I found this thread which provides a solution on how to do this (5th post) however that doesn't really solve my problem.

    I would like the image to be editable, so the user can upload a new image to overwrite the existing one. If they upload an image with a different name however the solution in the above thread wont work as the path will be different.

    How can I add an image into a template by using it's ID.

  • aghy 129 posts 308 karma points
    May 18, 2011 @ 12:34
    aghy
    0

    Hi Suzyb

    If you check that thread Dirk (2nd post) shows you how you can use some inline xslt to use on your masterpages. I think it's the 3rd example you will need.
    You just have to change the field to the name of the content picker.

    Ben

     

  • suzyb 474 posts 932 karma points
    May 18, 2011 @ 12:48
    suzyb
    0

    The image isn't a page property though so there is no content picker name.  I created a media node and uploaded the image directly in the media section.

  • aghy 129 posts 308 karma points
    May 18, 2011 @ 12:52
    aghy
    0

    Well if you want your image to be editable then I would suggest putting a media picker (sorry not content picker) on one of your doc types. This will then allow a user to upload an image to the media section without overwriting the old one.

    Ben

  • suzyb 474 posts 932 karma points
    May 19, 2011 @ 14:28
    suzyb
    0

    I think the image may be required on more than one page though :/  If not then I'll use a media picker but in the meantime I've made an xslt macro to output the image.

  • aghy 129 posts 308 karma points
    May 19, 2011 @ 15:29
    aghy
    0

    If you need it on more than one page then, depending on your sites structure, you could add it as a property to your home page and then use recursive="true" on the field in the template.

    In this case you would need to structure your site like this:

    Content
        -Home
            -AboutUs
            -Services
            ...

    This would also allow you to add a property to the Services document type with the same alias as the one on the home page and if gets set it will override the one defined on the home page.

    Ben

Please Sign in or register to post replies

Write your reply to:

Draft