Fieldtype, Module

Archived
Forum
(read-only)

CE Tweet

ExpressionEngine 2

Back to this add-on's main page
View Other Add-ons From Causing Effect

     

How do I get images to display

Support Request

Paul Frost
Paul Frost

I would like to show a thumbnail of images that are linked to in a tweet. Just like twitter does in it’s widget and Twitterific does. But I can’t see the code for it anywhere in the examples.

Tom van de Wetering
# 1
Tom van de Wetering

Hi Paul. I had to dive into the Twitter API because media/images aren’t described in the CE Tweet docs, but after some experimentation I got it working: calling {entities_media}{media_url}{/entities_media} works for me.

<!—example 1: replace tweets without images with a placeholder image—>
{exp:ce_tweet:user_timeline screen_name=“some_username” count=“4”}
  {exp:ce_tweet:show id=”{id}” link=”“}
  {entities_media} 
  {exp:ce_img:pair
  src=”{media_url}”
  width=“800”
  fallback_src=“http://placehold.it/300x220”
  }
  {made}
  {/exp:ce_img:pair}
        {/entities_media}>
{/exp:ce_tweet:show}
{/exp:ce_tweet:user_timeline}

<!—example 2: only display tweets with media/images via filter:images—>
{exp:ce_tweet:search
q=‘search terms filter:images’
count=“4”
}
  {statuses} 
  {exp:ce_tweet:show id=”{id}” link=”“}
      {entities_media}
      {media_url}
          {/entities_media}
{/exp:ce_tweet:show}
  {/statuses}
{/exp:ce_tweet:search}

ingridly
# 2
ingridly

Tom,

I’m so glad you posted this answer, I never would have figured this out otherwise. Do you know if it’s likewise possible to show a video attached to a tweet? Twitter’s docs indicate this should be possible within the equivalent of the “show” tag, but I’m not sure what the syntax should be.

Thank you!