We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 23018
    • 353 Posts
    Hi,

    I believe this problem is related to the proper use of filters. It could as well be related to phpthumbof. I really don’t know so I’ll start here.

    I want to output a list of thumbnail images. Depending on the value of a TV i have 3 different types of image formats

    hoch (portrait),
    breit (landscape),
    quad (square).

       [[getResources? 
       &parents=`[[*id]]` 
       &tpl=`Bildarchiv chronologisch - rowTpl`
       &sortby=`menuindex`
       &sortdir=`ASC` 
       &context=`de` 
       &limit=`0`
       &depth=`1`
       &includeTVs=`1`
       &processTVs=`1` 
       &tvPrefix=``
       &includeContent=`1`
       &width=`[[+objekt_format:is=`hoch`:then=`170`]][[+objekt_format:is=`breit`:then=`230`]][[+objekt_format:is=`quad`:then=`200`]]`
       ]]
    


    Please note, that I have added the &width parameter to my getResources call. Depending on [[+objekt_format]] the value of &width will be either 170,230 or 200.

    As expected, I can use [[+width]] inside the my tpl.


    <!-- [[+pagetitle]] ([[+width]]) -->
    <div id="item_[[+id]]" class="item">

    <a href="[[~[[+id]]]]">
    <img
    class="image_[[+width]]"
    src="[[phpThumbOf?
    &input=`[[+objekt_grafik]]` &options=`&w=[[+width]]&zc=0&f=jpeg&q=95` &onlysrc=`1`]]"
    alt="[[+pagetitle]]"
    />
    </a>

    <div class="item_details"">

    <div class="item_description">
    [[+pagetitle]]
    [[+content]]
    </div>

    </div>
    <div class="clearme">&nbsp;</div>
    </div>

    If I look at the source, I have a correct width value for each item inside the comment at line one. I also have correct class names (image_170, image_230 or image_200) for each item.

    The strange thing is that I only get correct thumbnails for the first Type of width I have defined inside the getressources width parameter.

    So I get a couple of images with a width of 170px.

    Items where I expect the width to be 230 or 200 only show up as 1x1px images with a black background. I believe they didn’t get a width value.


    It comes better, if I change the order of items inside &width=``, another type of image shows up and the other don’t.

    Question:

    Whats going wrong here?

    Kind regards,

    pepebe
      Homepage: pepebe.de | MODX snippets (and other stuff) at github: https://gist.github.com/pepebe