0

I have a image "thumbnail" field in multiple channels, ie: "news_thumbnail" "projects_thumbnail" "editorials_thumbnail"

With these images, I use EE's resizing feature to crop multiple sizes of the image.

I'm attempting to display the images using the following:

{{channel_short_code}_thumbnail}{path}_frontpage/{filename}.{extension}{/{channel_short_code_thumbnail}

This outputs to

{news_thumbnail}{path}_frontpage/{filename}.{extension}{/{news_thumbnail}

The {path} {filename} and {extension} variables aren't being processed properly.

However if I hardcode the channel field and use:

{news_thumbnail}{path}_frontpage/{filename}.{extension}{/{news_thumbnail}

{path},{filename} and {extension} are parsed to their proper values, and the image is displayed properly.

Any idea how to get this working properly?

  • Just to clarify - you mean (and are using) {channel_short_name}, correct? – Derek Hogue Mar 31 '15 at 18:50
0

You're trying to use the value of one variable (i.e., {channel_short_name}) to determine the key of another variable located at the same level of processing (i.e., {news_thumbnail}), which won't work.

I'd suggest using preload_replace variables instead, since they are parsed before any module tags are processed:

{preload_replace:current_channel="news"}

{exp:channel:entries channel="{current_channel}"}
    {{current_channel}_thumbnail}{path}_frontpage/{filename}.{extension}{/{current_channel}_thumbnail}
{/exp:channel:entries}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.