user-pic

Showing a TwitPic thumbnail in your AS

Vote 0 Votes

Hi there,

if you use TwitPic to post photos to Twitter you probably would like to show a thumbnail in your Action Stream. Here is how I did it.

First you need the good old Regex Plugin from Brad Choate (http://www.bradchoate.com/weblog/2002/07/27/mtregex). Then you need to define a regular expression like this:

s!(.*)(http://twitpic.com[^\s!g

Later you can treat Tweets that contain the word 'twitpic' like this



And you will get a nice thumbnail with a link to the proper TwitPic page.

PS I don't know if the regular expression is elegant. It works, but maybe someone can tweak it a little bit.

Regards, Yves

Reported on Movable Type 4.2

1 Reply

| Add a Reply
  • Argh, half of the code has vanished. An edit function would be cool to fix the posting. Here we go again:

    The regular expression:

    <MTAddRegex name="patt4">s!(.*)(http://twitpic.com[^\s<"&]+)(.*)!<a href="$2"><img src="$2-thumb.jpg" alt="" /></a>!g</MTAddRegex>

    Usage of the regular expression:

    <mt:If tag="StreamActionTitle" like="twitpic">
       <mt:StreamActionTitle regex="patt4" />
    </mt:If>

    Sorry, for the trouble.

Add a Reply

Forum Groups

151 405

Last Topic: MT Interface Missing by Sherri on Nov 10, 2008

36 144

Last Topic: Installation can't finish by Drazend on Nov 10, 2008

34 93

Last Topic: Creating your own Plug-in by jondauz on Nov 5, 2008

10 33

Last Topic: new licensing confusion by Neil Epstein on Aug 14, 2008

code.sixapart.com

62 226

Last Topic: Callback after blog publishing. by Tomato Interactive on Oct 27, 2008

34 98

Last Topic: Ajax Rating Plugin by kiran on Oct 17, 2008