1

I'm using a simplenews template (simplenews-newsletter-body.tpl.php) to output with mimemail in html.

Everything works as it should except that the image in my newsletter is always taken from the original size (/sites/default/files/blogs/blablabla.jpg) instead of the smaller "image style" that I created.

In my template, I use the token: [node:field_image], as it's the only available choice I found.

Do you guys have an idea of what I should try?

Thanks

0

Disclaimer: I've not personally tested this in detail...

To apply specific formatting to an image token (thus applying an image style to the URL) I think you'll have to define a "token" view mode for relevant node content type. Once this view mode is setup you should be able to configure display settings on your field_image field (within this view mode) which should used when the token is rendered.

Some instructions on that are available here.

To get full field token support, and therefore this feature, I think you have enable the actual token module. It looks like core's token support does not fully cover field tokens in this way.

It may also be worth looking into the imagecache_token module. If I'm not mistaken it would allow you to declare an image style on your token directly via chaining, something like [node:field_image:style_name]. However, that module is not available as a stable release yet, and it's compatibility with field tokens is not totally clear.

  • Thanks for taking the time to post your comment. I've tried everything you mentioned above and imagecache_token was the one that worked for me. – sly-gdk Feb 26 '15 at 15:44
  • For the first option (the "token" view mode), were you able to setup the view mode successfully but the token rendering behavior didn't change? Or were there issues just getting the view mode working? – rjacobs Feb 26 '15 at 16:19
  • I had no issue getting the view mode working but the image was missing when I got the newsletter. – sly-gdk Feb 26 '15 at 18:00
  • Out of curiosity does the token formatting work if you use it somewhere besides the newsletter? I'm just wondering if the mimemail handling of tokens is somehow incompatible with the first method. That is of course unless you've decided to just go with the imagecache_token approach. – rjacobs Feb 27 '15 at 23:09

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.