We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 33993
    • 9 Posts
    Hey guys -

    I used the search but didn't find a solution, sorry!

    I have a blog on my website in which I want to include preview Images for blog posts.

    -> I created a TV: PreviewImage, Input: Image, Output: Image.
    -> Selecting the image in the blog post works just fine

    -> Want to output it in my blog post list (Chunk "blogPost") kinda like this (unformatted for now):
    <img src="[[*PreviewImage]]" />
    <div class="ditto_summaryPost">
      <h3><a href="[[~[[+id]]]]" title="[[+pagetitle]]">[[+pagetitle]]</a></h3>
      <br />
      [[+introtext:empty=`[[+content]]`]]
      <p class="ditto_link"><a href="[[~[[+id]]]]" class="readmore">Weiterlesen</a></p>
      <br /><br />
    </div>
    


    In my html output, it shows the <img /> tag, but the src="" ist empty - what did I do wrong?
    Shouldn't it output <img src="http://example.com/assets/images/example.jpg" /> ?

    Thanks a lot! [ed. note: c.kurtzmann last edited this post 15 years, 1 month ago.]
      • 22427
      • 793 Posts
      <img src="" />
      Here the MODx tags got lost (it's like that in this forum...)
      Try to make bold the first [ of the tag: <img src="[[*PreviewImage]]" />
      But that does not answer your question, of course...
      I think the Output Type should be URL, not image. [ed. note: ottogal last edited this post 15 years, 1 month ago.]
        • 4172
        • 5,888 Posts
        Quote from: c.kurtzmann at Aug 29, 2011, 03:33 PM
        Hey guys -

        I used the search but didn't find a solution, sorry!

        I have a blog on my website in which I want to include preview Images for blog posts.

        -> I created a TV: PreviewImage, Input: Image, Output: Image.
        -> Selecting the image in the blog post works just fine

        -> Want to output it in my blog post list (Chunk "blogPost") kinda like this (unformatted for now):
        <img src="[[*PreviewImage]]" />
        <div class="ditto_summaryPost">
          <h3><a href="[[~[[+id]]]]" title="[[+pagetitle]]">[[+pagetitle]]</a></h3>
          
        
          [[+introtext:empty=`[[+content]]`]]
          <p class="ditto_link"><a href="[[~[[+id]]]]" class="readmore">Weiterlesen</a></p>
          
        
        
        </div>


        In my html output, it shows the <img /> tag, but the src="" ist empty - what did I do wrong?
        Shouldn't it output <img src="http://example.com/assets/images/example.jpg" /> ?

        Thanks a lot!

        use
        <img src="[[+PreviewImage]]" />

        in your chunk
          -------------------------------

          you can buy me a beer, if you like MIGX

          http://webcmsolutions.de/migx.html

          Thanks!
          • 33993
          • 9 Posts
          Quote from: Bruno17 at Aug 30, 2011, 01:52 AM

          use
          <img src="[[+PreviewImage]]" />

          in your chunk

          Unfortunately, even that doesn't work.

          I tried
          <img src="[[+PreviewImage]]" />
          and
          <img src="[[*PreviewImage]]" />

          I don't get it - all the other TVs and Chunks work just fine!
            • 33968
            • 863 Posts
            Which snippet are you using to output your list... getResources? (wasn't sure why you had Ditto classes in there smiley)

            For getResources, tv placeholders need to be prefixed like this:
            [[+tv.PreviewImage]]
            
              • 33993
              • 9 Posts
              Quote from: okyanet at Aug 30, 2011, 03:50 AM
              Which snippet are you using to output your list... getResources? (wasn't sure why you had Ditto classes in there smiley)

              For getResources, tv placeholders need to be prefixed like this:
              [[+tv.PreviewImage]]
              

              Awesome! Thank you Lucas, that did it!
              I'm new to ModX and used the default Chunk for the blog posts listing...