Subscriptions template: test for imagefield I send digest newsletters with the subscription module (using the templates that comes with the module), sometimes containing a small image before the teasertext (positioned with tables/row/column). This is all working well.

However in case there is no image available (because there is no teaser image uploaded to the applicable field or the contentitem doesn't even have a image field with that name) I get an ugly image outline in most email clients.
I would like to test if there is an image available and if not, not adding the first ... leaving only the teaser text.

Can someone explain which "template" code must be used in order to achieve this?

Code used so far:

    Your subscriptions on [site:name] notify you of the following changes since the previous digest:&lt;br /&gt;

    {{[subs:items:count]#&lt;img src="http://@mydomain@/Newsletter/fine-line.jpg" width="580" height="18"&gt;&lt;br /&gt;
    #1 of [subs:items:count] {{[subs:items:index:#0:subs:is-new]?(new):}}{{[subs:items:index:#0:subs:is-updated]?(updated):}}{{[subs:items:index:#0:subs:is-old]?(commented): &lt;b&gt;[subs:items:index:#0:as-node:title]&lt;/b&gt;}}

    &lt;table border="0" width="100%" padding="5"&gt;
        &lt;tr&gt;
            &lt;td valign="top"&gt;&lt;img src="[subs:items:index:#0:as-node:field_news_image]" alt="teaser image" width="100" /&gt;&lt;/td&gt;
            &lt;td style="font-family: Calibri, Arial, Helvetica, sans-serif;" valign="top" align="left"&gt;[subs:items:index:#0:as-node:summary]&lt;/td&gt;
        &lt;/tr&gt;
    &lt;/table&gt; 
    Read more: [subs:items:index:#0:as-node:url]&lt;br /&gt;
    }}
If you can use php in the template (?) I would just wrap the cell containing the image in an if statement, something like this:

Your subscriptions on [site:name] notify you of the following changes since the previous digest:&lt;br /&gt;

{{[subs:items:count]#&lt;img src="http://@mydomain@/Newsletter/fine-line.jpg" width="580" height="18"&gt;&lt;br /&gt;
#1 of [subs:items:count] {{[subs:items:index:#0:subs:is-new]?(new):}}{{[subs:items:index:#0:subs:is-updated]?(updated):}}{{[subs:items:index:#0:subs:is-old]?(commented): &lt;b&gt;[subs:items:index:#0:as-node:title]&lt;/b&gt;}}

&lt;table border="0" width="100%" padding="5"&gt;
    &lt;tr&gt;

        &lt;?php if(**code to determine if image exists**): ?&gt;
        &lt;td valign="top"&gt;&lt;img src="[subs:items:index:#0:as-node:field_news_image]" alt="teaser image" width="100" /&gt;&lt;/td&gt;
        &lt;?php endif ?&gt;

        &lt;td style="font-family: Calibri, Arial, Helvetica, sans-serif;" valign="top" align="left"&gt;[subs:items:index:#0:as-node:summary]&lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt; 
Read more: [subs:items:index:#0:as-node:url]&lt;br /&gt;
}}


That way if there's no image it just won't print the cell at all and the other cell will take the entire width of the table.

If you can't use php in the template then I'm not sure how you could deal with it except perhaps by merging the two cells like this:

&lt;td style="font-family: Calibri, Arial, Helvetica, sans-serif;" valign="top"&gt;
  &lt;img src="[subs:items:index:#0:as-node:field_news_image]" alt="teaser image" width="100" /&gt;[subs:items:index:#0:as-node:summary]
&lt;/td&gt;