Archive

Archive for the ‘Development’ Category

How to get thumbnails of YouTube Videos!

February 19th, 2010 CodeBlink Comments

I’ve been working on a video contest project in PHP and it involves user’s submitting their videos from a YouTube link. I needed to show just thumbnails of the videos without having to use a full YouTube embed code. I really didn’t want to get my hands dirty with any kind of YouTube API though. So with a little bit of searching I found that YouTube creates multiple dynamic thumbnails for all of their videos when they’re uploaded.

For example purposes, I will use the incredible, mind-blowing, face-melter music video by DragonForce “Through the Fire and Flames”.

The URLs

In order to properly form a URL for the image, first you’ll need to grab the video’s ID. You get this from the YouTube video’s URL.
This DragonForce’s URL is http://www.youtube.com/watch?v=0jgrCKhxE1s, so it’s YouTube ID is 0jgrCKhxE1s.

Now here are the URLs you have available …

120×90 image – Choice 1
http://img.youtube.com/vi/[YouTube ID]/1.jpg

http://img.youtube.com/vi/0jgrCKhxE1s/1.jpg



120×90 image – Choice 2
http://img.youtube.com/vi/[YouTube ID]/2.jpg

http://img.youtube.com/vi/0jgrCKhxE1s/2.jpg



120×90 image – Choice 3

http://img.youtube.com/vi/[YouTube ID]/3.jpg

http://img.youtube.com/vi/0jgrCKhxE1sg/3.jpg



120×90 image – Default Choice

http://img.youtube.com/vi/[YouTube ID]/default.jpg

http://img.youtube.com/vi/0jgrCKhxE1s/default.jpg



480×360 image – High Quality (HQ) Choice
(does not need to be an HQ video to have an HQ image)

http://img.youtube.com/vi/[YouTube ID]/hqdefault.jpg

http://img.youtube.com/vi/0jgrCKhxE1s/hqdefault.jpg

480×360 image – HQ Choice 1

http://img.youtube.com/vi/[YouTube ID]/hq1.jpg

http://img.youtube.com/vi/0jgrCKhxE1s/hq1.jpg

480×360 image – HQ Choice 2

http://img.youtube.com/vi/[YouTube ID]/hq2.jpg

http://img.youtube.com/vi/0jgrCKhxE1s/hq2.jpg

480×360 image – HQ Choice 3

http://img.youtube.com/vi/[YouTube ID]/hq3.jpg

http://img.youtube.com/vi/0jgrCKhxE1s/hq3.jpg

 

If anyone knows any other tricks, please share! :)

  • Share/Bookmark

The taste left in my mouth by moonfruit is bittersweet

Sorry for not updating sooner. I’ve been very busy at my day job and afterwards with work on the next Project Peru site. My mind has been a-buzz all week!

So no, I didn’t win jack from the MoonFruit contest. Didn’t even get a “wow, this guy’s site idea sucks balls!” (or something along those lines) tweet from @moontweet.

Only one of my friends tweeted about it and left a comment on the site (thanks @DonnaVitan!) even after I e-mailed a bunch of people that I figured would totally help me out. Am I bit tweaked about that? Ya of course. Don’t want to make a sob story of a blog posty, but WTF?

What the hell happened here? Why was this such an epic fail in networking? This is something that will haunt for quite a while I think.

I know the people I e-mailed when to the site, and some people from Twitter went to the link I tweeted about (who knows if @moontweet was one of them). In 6 days, the site received 136 unique visitors, with 900 page views. That’s about the only thing that I found remotely successful about this little endeavour.

Sorry MoonFruit, I will work on my lame YouTube video acting and solarizing Photoshop filters for the next contest :Pem

Oh and the icing on the cake was that they ended up giving out morn 3 iPods after the creative contest was finished!

POLL: Did you enter the MoonFruit contest on Twitter?

View Results

Loading ... Loading ...
  • Share/Bookmark

Random Moonfruit Launch

I just finished launching and announcing http://randommoonfruit.info. A site with a little twist! Hopefully it will bring you a few giggles and for ME – a free iPod Touch! So please visit and Tweet about it: http://randommoonfruit.info/ Make sure to use the #moonfruit hash tag to have your own chance to win a MacBook Pro for free!

This idea came around from the Twitter contest Moonfruit (http://www.moonfruit.com) has been having. By using a #moonfruit hash tag in a tweet, Tweeple are being entered for 1 daily draw of a free MacBook Pro (details found here: http://www.moonfruit.com/macbook-pro.html). Moonfruit is also giving away 3 free iPod Touches for the best creative ideas. 2 have already been given away.. I just hope I’m in time for being considered for the third!

I’ll keep you posted on events as they unfold.

  • Share/Bookmark

A Simple Unicode Decoder/Converter Function for PHP 5

I wanted to use the unicode_decode PHP function for something I was working on today, but, of course, this function is only supported in the new PHP 6. I don’t know how it is for my fellow programmers reading this, but getting your I.T. department to upgrade all servers from 5 to 6 can be like getting your grandfather to change from a rotary phone to a iPhone. I.T. is uber apprehensive about such serious change. Their servers are their babies and ‘upgrade’ translates to ‘extreme security risk’ in their minds.

Don’t get me wrong, I love my company and my I.T. department, but when it comes to upgrading – I would be very thankful for a little more progressive thinking. At the same time, I understand the apprehension and can’t fault it completely, but PHP is no longer a light-weight in the world of server-side scripting.

Rant aside, I came up with this really simple function to help me decode Unicode text. Hope it helps!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
function simple_unicode_decode($str) {
    $str=str_ireplace("u0001","☺",$str);
    $str=str_ireplace("u0002","☻",$str);
    $str=str_ireplace("u0003","♥",$str);
    $str=str_ireplace("u0004","♦",$str);
    $str=str_ireplace("u0005","♣",$str);
    $str=str_ireplace("u0006","♠",$str);
    $str=str_ireplace("u0007","•",$str);
    $str=str_ireplace("u0008","◘",$str);
    $str=str_ireplace("u0009","○",$str);
    $str=str_ireplace("u000A","◙",$str);
    $str=str_ireplace("u000B","♂",$str);
    $str=str_ireplace("u000C","♀",$str);
    $str=str_ireplace("u000D","♪",$str);
    $str=str_ireplace("u000E","♫",$str);
    $str=str_ireplace("u000F","☼",$str);
    $str=str_ireplace("u0010","►",$str);
    $str=str_ireplace("u0011","◄",$str);
    $str=str_ireplace("u0012","↕",$str);
    $str=str_ireplace("u0013","‼",$str);
    $str=str_ireplace("u0014","¶",$str);
    $str=str_ireplace("u0015","§",$str);
    $str=str_ireplace("u0016","?",$str);
    $str=str_ireplace("u0017","?",$str);
    $str=str_ireplace("u0018","↑",$str);
    $str=str_ireplace("u0019","↓",$str);
    $str=str_ireplace("u001A","→",$str);
    $str=str_ireplace("u001B","←",$str);
    $str=str_ireplace("u001C","∟",$str);
    $str=str_ireplace("u001D","↔",$str);
    $str=str_ireplace("u001E","▲",$str);
    $str=str_ireplace("u001F","▼",$str);
    $str=str_ireplace("u0020"," ",$str);
    $str=str_ireplace("u0021","!",$str);
    $str=str_ireplace("u0022","\"",$str);
    $str=str_ireplace("u0023","#",$str);
    $str=str_ireplace("u0024","$",$str);
    $str=str_ireplace("u0025","%",$str);
    $str=str_ireplace("u0026","&",$str);
    $str=str_ireplace("u0027","'",$str);
    $str=str_ireplace("u0028","(",$str);
    $str=str_ireplace("u0029",")",$str);
    $str=str_ireplace("u002A","*",$str);
    $str=str_ireplace("u002B","+",$str);
    $str=str_ireplace("u002C",",",$str);
    $str=str_ireplace("u002D","-",$str);
    $str=str_ireplace("u002E",".",$str);
    $str=str_ireplace("u2026","…",$str);
    $str=str_ireplace("u002F","/",$str);
    $str=str_ireplace("u0030","0",$str);
    $str=str_ireplace("u0031","1",$str);
    $str=str_ireplace("u0032","2",$str);
    $str=str_ireplace("u0033","3",$str);
    $str=str_ireplace("u0034","4",$str);
    $str=str_ireplace("u0035","5",$str);
    $str=str_ireplace("u0036","6",$str);
    $str=str_ireplace("u0037","7",$str);
    $str=str_ireplace("u0038","8",$str);
    $str=str_ireplace("u0039","9",$str);
    $str=str_ireplace("u003A",":",$str);
    $str=str_ireplace("u003B",";",$str);
    $str=str_ireplace("u003C","<",$str);
    $str=str_ireplace("u003D","=",$str);
    $str=str_ireplace("u003E",">",$str);
    $str=str_ireplace("u2264","≤",$str);
    $str=str_ireplace("u2265","≥",$str);
    $str=str_ireplace("u003F","?",$str);
    $str=str_ireplace("u0040","@",$str);
    $str=str_ireplace("u0041","A",$str);
    $str=str_ireplace("u0042","B",$str);
    $str=str_ireplace("u0043","C",$str);
    $str=str_ireplace("u0044","D",$str);
    $str=str_ireplace("u0045","E",$str);
    $str=str_ireplace("u0046","F",$str);
    $str=str_ireplace("u0047","G",$str);
    $str=str_ireplace("u0048","H",$str);
    $str=str_ireplace("u0049","I",$str);
    $str=str_ireplace("u004A","J",$str);
    $str=str_ireplace("u004B","K",$str);
    $str=str_ireplace("u004C","L",$str);
    $str=str_ireplace("u004D","M",$str);
    $str=str_ireplace("u004E","N",$str);
    $str=str_ireplace("u004F","O",$str);
    $str=str_ireplace("u0050","P",$str);
    $str=str_ireplace("u0051","Q",$str);
    $str=str_ireplace("u0052","R",$str);
    $str=str_ireplace("u0053","S",$str);
    $str=str_ireplace("u0054","T",$str);
    $str=str_ireplace("u0055","U",$str);
    $str=str_ireplace("u0056","V",$str);
    $str=str_ireplace("u0057","W",$str);
    $str=str_ireplace("u0058","X",$str);
    $str=str_ireplace("u0059","Y",$str);
    $str=str_ireplace("u005A","Z",$str);
    $str=str_ireplace("u005B","[",$str);
    $str=str_ireplace("u005C","\\",$str);
    $str=str_ireplace("u005D","]",$str);
    $str=str_ireplace("u005E","^",$str);
    $str=str_ireplace("u005F","_",$str);
    $str=str_ireplace("u0060","`",$str);
    $str=str_ireplace("u0061","a",$str);
    $str=str_ireplace("u0062","b",$str);
    $str=str_ireplace("u0063","c",$str);
    $str=str_ireplace("u0064","d",$str);
    $str=str_ireplace("u0065","e",$str);
    $str=str_ireplace("u0066","f",$str);
    $str=str_ireplace("u0067","g",$str);
    $str=str_ireplace("u0068","h",$str);
    $str=str_ireplace("u0069","i",$str);
    $str=str_ireplace("u006A","j",$str);
    $str=str_ireplace("u006B","k",$str);
    $str=str_ireplace("u006C","l",$str);
    $str=str_ireplace("u006D","m",$str);
    $str=str_ireplace("u006E","n",$str);
    $str=str_ireplace("u006F","o",$str);
    $str=str_ireplace("u0070","p",$str);
    $str=str_ireplace("u0071","q",$str);
    $str=str_ireplace("u0072","r",$str);
    $str=str_ireplace("u0073","s",$str);
    $str=str_ireplace("u0074","t",$str);
    $str=str_ireplace("u0075","u",$str);
    $str=str_ireplace("u0076","v",$str);
    $str=str_ireplace("u0077","w",$str);
    $str=str_ireplace("u0078","x",$str);
    $str=str_ireplace("u0079","y",$str);
    $str=str_ireplace("u007A","z",$str);
    $str=str_ireplace("u007B","{",$str);
    $str=str_ireplace("u007C","|",$str);
    $str=str_ireplace("u007D","}",$str);
    $str=str_ireplace("u02DC","˜",$str);
    $str=str_ireplace("u007E","∼",$str);
    $str=str_ireplace("u007F","",$str);
    $str=str_ireplace("u00A2","¢",$str);
    $str=str_ireplace("u00A3","£",$str);
    $str=str_ireplace("u00A4","¤",$str);
    $str=str_ireplace("u20AC","€",$str);
    $str=str_ireplace("u00A5","¥",$str);
    $str=str_ireplace("u0026quot;","\"",$str);
    $str=str_ireplace("u0026gt;",">",$str);
    $str=str_ireplace("u0026lt;",">",$str);
    return $str;
}

POLL: What do you think? (Simple Unicode Decode)

View Results

Loading ... Loading ...

Please leave a comment or suggestion below!

  • Share/Bookmark

Birdnapper 1.1 Now Available

April 29th, 2009 CodeBlink Comments

1.1 Update

Added a line of code to fix inline links to Twitter profile pages. Links will now be external to http://twitter.com. I discovered this flaw when I checked out my Google Webmaster report!

Birdnapper now has a home of it’s on on codeblink.com here: http://www.codeblink.com/codeblink-open-source-projects/birdnapper-the-php-twitter-feed-widget/

  • Share/Bookmark

Birdnapper Twitter Widget Release

April 13th, 2009 CodeBlink Comments

I have removed this blog and made a dedicated page to the development of this widget here: http://www.codeblink.com/codeblink-open-source-projects/birdnapper-the-php-twitter-feed-widget/

  • Share/Bookmark

Twitter Widget in the works

Widgets are fun. Why not something for Twitter? It’s probably been done before (didn’t even bother searching for anything before deciding to make this) but I thought it would be fun to just make something on my own.

When it’s done I’ll be posting a link for you all to download and try out.

  • Share/Bookmark

First Blink

The building of CodeBlink.com has begun! Please contain yourselves…

  • Share/Bookmark
Categories: Development Tags: