Image style URL isn't returning as empty

Created on 16 December 2024, 4 months ago

Problem/Motivation

I’m encountering an issue with image URL tokens using image styles, where empty values aren’t handled as expected.

So my token stack looks like this...

[
easy_email:field_report:entity:field_youtube_video__youtube_image_url|
easy_email:field_report:entity:field_photos:0:scale_crop_600x350:url|
easy_email:field_report:entity:field_body_of_water:entity:field_water_photos:0:scale_crop_600x350:url
] 

When youtube_image_url is empty, the module works as expected and moves to the next token. However, if field_photos or field_water_photos is empty, the process stops and doesn’t render the next token in the sequence—even if I rearrange the order (e.g., placing field_water_photos before field_photos).

Am I missing something? Should I be calling the image URLs with image styles differently?

💬 Support request
Status

Active

Version

2.3

Component

Miscellaneous

Created by

🇺🇸United States chucksimply

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @chucksimply
  • 🇺🇸United States chucksimply

    Could this issue be related to the token’s depth? Even using just
    [easy_email:field_report:entity:field_photos]
    isn’t recognized as empty, and the process stops.

  • 🇺🇸United States pianomansam

    Could this issue be related to the token’s depth? Even using just
    [easy_email:field_report:entity:field_photos]
    isn’t recognized as empty, and the process stops.

    @chucksimply Sorry to hear that you are experiencing issues. When you uninstall token_or, does this token produce a value?

  • 🇺🇸United States chucksimply

    The token output behaves as expected, whether or not the token_or module is installed.

    For example, with this field: [easy_email:field_report:entity:field_photos]
    • If the field contains an image, the value displays correctly.
    • If the field is empty, no value is produced—there’s nothing returned (no space, extra character, or anything).

    However, the token_or module still treats it as if it has a value, even when nothing is returned.

  • 🇺🇸United States pianomansam

    @chucksimply I'm unable to reproduce this. I've tried to make this happen with a multi-value image media field and displaying the image style url of the second entity in the field, then falling back to the first entity in the field. The functionality worked as expected.

    [node:field_banner:1:entity:field_media_image:featured_image_desktop:url|node:field_banner:0:entity:field_media_image:featured_image_desktop:url]

    Can you reproduce from a clean site install and provide all the necessary steps? Or even better, create a feature branch and write a test reproducing the issue?

  • 🇺🇸United States chucksimply

    Apologies for my delayed response. Wondering if this has to do with the way the Easy Email module handles its tokens? I'll have to do further tests and circle back. Thanks again for the quick replies.

Production build 0.71.5 2024