Hi guys,
I've written a small snippet that creates an absolute path to a thumbnail of a larger image. I've tested it on a page containing the larger image and it outputs the path as expected.
When I try to use that snippet on a getResources tpl it doesn't work. I tried a workaround by putting the snippet call in a TV and retrieve that TV through getResources. That too fails, what Am I doing wrong?
Here's the snippet:
//Get TV Value
$tvid = 89;
$tvval = $modx->resource->getTVValue($tvid);
//Get poster path
$poster_path = pathinfo($tvval);
//Output thumb path
echo $poster_path['dirname'] . "/thumbs/" . $poster_path['basename'];
Here's the getResources tpl
<a href="[[~[[+id]]]]" class="thumb">
<span class="duration">[[+tv.ClipDuration]]</span>
<span class="caption">[[+pagetitle:limit=`30`]]</span>
<img src="[[MessageThumbPath]]" width="203" height="103" alt="[[+pagetitle]]" />
</a>
<!--/ Item -->
--EDITS
I even tried using @EVAL on a TV, but all I'm getting is: /thumbs/ which tells me it's not outputting the dirnames and file names
here's my EVAL code:
@EVAL $tvid = 89; $tvval = $modx->resource->getTVValue($tvid); $poster_path = pathinfo($tvval); echo $poster_path['dirname'] . "/thumbs/" . $poster_path['basename'];
Any thoughts?
[ed. note: treigh last edited this post 14 years, 4 months ago.]