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

    I don't get working phpThumbOf within a migxLoopCollection call.

    My MODX 2.3.1 is installed in a subdirectory mysub, and the [[++assets_url]] setting renders correctly to /mysub/assets/.

    In the custom table there is a field myimage,
    the media source for it is
    /mysub/assets/images/product-images/,
    an example image is
    /mysub/assets/images/product-images/picture1.jpg

    In the snippet call
    [[!migxLoopCollection? .... &tpl=`myRowTpl` ]]

    the chunk myRowTpl contains an image:
    <img src="[[++assets_url]]images/product-images/[[+myimage]]" width="100" />
    and all works fine.

    But when I use the phpthumbof modifier instead,
    <img src="[[++assets_url]]images/product-images/[[+myimage:phpthumbof=`w=100`]]" />
    
    the images are not found.
    The error console says
    [2014-07-28 10:23:58] (ERROR @ /www/htdocs/########/mysub/core/model/phpthumb/phpthumb.class.php : 1596) PHP warning: getimagesize(/www/htdocs/########/mysub/mysub/picture1.jpg) [<a href='function.getimagesize'>function.getimagesize</a>]: failed to open stream: No such file or directory
    followed by a longer list of follow-up errors and warnings. And then the same for all the other images of the list.

    Notice the totally wrong path
    /mysub/mysub/picture1.jpg
    of the image, that should be
    /mysub/images/product-images/picture1.jpg

    What is causing this behaviour?





    This question has been answered by Bruno17. See the first response.

    [ed. note: ottogal last edited this post 9 years, 9 months ago.]
      • 22019
      • 390 Posts
      Looks like phphthumb is trying to write to a url of
      [++assets_url]/[++assets_url]
      Have a look in the phpthumbof settings under Site Settings to see if it's being set there. From memory it usually expects you to want to write thumbnails to a different directory from the 'normal' one, although it defaults to the assets one.
        Writer > E-consultant > MODx developer || Salesforce || modx 2.x || PHP 5.2.13 || MySQL client 5.0.86
      • discuss.answer
        • 4172
        • 5,888 Posts
        you need to add the path to the filename, before sending it to the phpthumbof - output-filter

        <img src="[[+myimage:add_before=`[[++assets_url]]images/product-images/`:phpthumbof=`w=100`]]" />


        snippet add_before:

        return $options.$input;
          -------------------------------

          you can buy me a beer, if you like MIGX

          http://webcmsolutions.de/migx.html

          Thanks!
          • 22427
          • 793 Posts
          @ odeclas:
          Thank you - but there was no special setting.

          @ Bruno17:
          Yes! - of course. I wouldn't have had the idea for this nice tiny snippet...
          Thanks again!