URL Tube

ExpressionEngine 2

Back to this add-on's main page
View Other Add-ons From Mark Spurlock


You must be logged in to post.

Output thumbnail url only



Is there a way to only output the url of a video’s thumbnail, rather than a full image tag? I’d like to be able to pass the url to CE Image to do some manipulations.

# 1

Hello artmem, thanks for asking about this.

Currently URL Tube doesn’t have an option for outputting thumbnail URLs by themselves. I did some experiments trying to find a way to hack this together with existing tags, but came to an unfortunate conclusion:

As far as I can tell from looking at the template debugging, I think that even if I were to build in this feature, you still wouldn’t get CE Image to play nice with the thumbnail URL. This is because (again, as best I can tell from poking around a bit) the CE Image tag is going to try and parse its “src” attribute as text, not first check to see whether it’s another EE tag. So even if I build in a way for URL Tube to spit out thumbnail URLs, it wouldn’t matter because CE Image would try and do its thing before URL Tube could do its, causing CE Image to get confused and sputter out some nonsense.

Long story short… I don’t think outputting thumbnail URLs would let you accomplish what you’re trying to accomplish even if it were supported. Sorry.

My only suggestion would be to do the URL Tube part of the job with input-stage PHP parsing. If you know PHP well, let me know and I’ll suggest how I’d go about it. If not, probably more trouble than it’s worth.

# 2

I played around with it a bit and got it to work.

I added this to the plugin:

function thumburl() 
        if (
$this->getVideoSite($s) != 'youtube')

$vid $this->getVideoID($s);
$sel $this->makeSelectorString();


and used this as my CE image tag:

{exp:ce_img:single src="{exp:url_tube:thumburl src='{video}'}" max="300" crop="yes" parse="inward"

Adding parse=“inward” makes CE Image parse the URL Tube tag first.

# 3

Ah, I totally forgot “parse inward” was a thing. Clever, glad you got it working!

For anyone reading this who doesn’t want to write PHP, I think the following should also work if passed as CE Image’s src and used with parse=‘inward’:{exp:url_tube:id src='{whatever}'/0.jpg";