Changing the Thumbnail on a YouTube Video to a Custom Image

The following code will allow you to use a custom image for the thumbnail on a YouTube video.

<div style="float: right; padding: 20px;"><img style="cursor: pointer;" src="/wp-content/uploads/2012/10/iframeyoutubevideo.png" alt="" /></div>
<div id="thevideo" style="display: none; float: right; padding: 20px;"><object width="460" height="259" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/tX4l7aPoYLU?version=3&amp;hl=en_US&amp;rel=0&amp;autoplay=1&amp;autohide=1" /><param name="allowfullscreen" value="true" /><embed width="460" height="259" type="application/x-shockwave-flash" src="http://www.youtube.com/v/tX4l7aPoYLU?version=3&amp;hl=en_US&amp;rel=0&amp;autoplay=1&amp;autohide=1" allowfullscreen="allowfullscreen" allowscriptaccess="always" allowfullscreen="allowfullscreen" /></object></div>

Here is an example of what the video would look like.

<div style="float: right; padding: 20px;"><img style="cursor: pointer;" src="/wp-content/uploads/2012/10/iframeyoutubevideo.png" alt="" /></div>
<div id="thevideo" style="display: none; float: right; padding: 20px;"><object width="460" height="259" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/tX4l7aPoYLU?version=3&amp;hl=en_US&amp;rel=0&amp;autoplay=1&amp;autohide=1" /><param name="allowfullscreen" value="true" /><embed width="460" height="259" type="application/x-shockwave-flash" src="http://www.youtube.com/v/tX4l7aPoYLU?version=3&amp;hl=en_US&amp;rel=0&amp;autoplay=1&amp;autohide=1" allowfullscreen="allowfullscreen" allowscriptaccess="always" allowfullscreen="allowfullscreen" /></object></div>

Did you like this article?


0 Shares:
You May Also Like

Exim4 and PHP and PHP-CGI mail() function using incorrect From: and applying Sender: headers.

If you're using Exim4 and PHP as a module or as a CGI with suexec. You may have noticed some issues with your mail. Specifically you would have noticed that either the "From:" header was using "nobody@machinename" or "user@machine name, its also possibly that you had an additional header called "Sender:". There are two things you need to do to fix this. You first need to make sure that your "php.ini" has the following value "sendmail_path = /usr/sbin/sendmail -t -i". Which is the default, double check this variable as it might be set to something else.
Read More