Monday, January 28, 2013

Play Youtube videos On a Embedded Player Upon clicking


<!doctype html>
<html>
<head>
<meta charset=”utf-8″>
<title>Untitled Document</title>
<script src=”http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js&#8221; type=”text/javascript”></script>
<script src=”http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js&#8221; type=”text/javascript”></script>
<script type=”text/javascript”>
function play(clip){
var mv = “http://www.youtube.com/v/”+clip+”&autoplay=0&rel=0&#8243;;
swfobject.embedSWF(mv, “myContent”, “375″, “295″, “8″);
}
$(document).ready(function() {
play(‘CsGYh8AacgY’);
});
</script>
</head>

<body>
<div id=”myContent”></div>
<br />

<B>Choose Video:</B>
<a href=”#” onclick=”play(‘yFhEsUUvwYE’); return false” style=”color:#9b9898; font-size:12″>Charlie 1</a> |
<a href=”#” onclick=”play(’596gXXYcMIY’); return false” style=”color:#9b9898; font-size:12″>Charlie 2</a> |
<a href=”#” onclick=”play(‘wOVAF68uvM8′); return false” style=”color:#9b9898; font-size:12″>Charlie 3</a>

</body>
</html>

Save image from url to local or remote directory using php



<?php
ini_set(‘max_execution_time’, 180);

function GetImageFromUrl($link)
{
$ch = curl_init();

curl_setopt($ch, CURLOPT_POST, 0);

curl_setopt($ch,CURLOPT_URL,$link);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

$result=curl_exec($ch);

curl_close($ch);

return $result;
}

$url=$_POST['txtUrl'];

$html = file_get_contents($url);

$doc = new DOMDocument();
@$doc->loadHTML($html);

$tags = $doc->getElementsByTagName(‘img’);

foreach ($tags as $tag) {

$sanjoy= $tag->getAttribute(‘jqimg’);

if (substr($sanjoy, 0, 5) == ‘/pic/’) {
//echo $abid ;

$ImgName=substr($abid, 5);
$Full_Image_Path=’http://www.pleaserusa.com/pic/&#8217; . $ImgName;
$Imag_Save_Path=’E:/Picture/’.$ImgName;
echo $Full_Image_Path ;
echo ‘<br />’;

$sourcecode=GetImageFromUrl($Full_Image_Path);

$savefile = fopen($Imag_Save_Path, ‘w’);
fwrite($savefile, $sourcecode);
fclose($savefile);
}
}
?>
<a href=”index.html”>Back</a>

Text Drop Shadow Using CSS

Drop Shadow With CSS3 For All Web Browsers

Sample:



.shadow { 
text-shadow: 0 1px 0 #ccc, 0 2px 0 #c9c9c9, 0 3px 0 #bbb, 0 4px 0 #b9b9b9, 0 5px 0 #aaa, 0 6px 1px rgba(0,0,0,.1), 0 0 5px rgba(0,0,0,.1), 0 1px 3px rgba(0,0,0,.3), 0 3px 5px rgba(0,0,0,.2), 0 5px 10px rgba(0,0,0,.25), 0 10px 10px rgba(0,0,0,.2), 0 20px 20px rgba(0,0,0,.15);
 }


The Combined Styles For All Web Browser Support


.shadow {
-moz-box-shadow: 3px 3px 4px #000;
 -webkit-box-shadow: 3px 3px 4px #000; 
 box-shadow: 3px 3px 4px #000;
 /* For IE 8 */ -ms-filter: "progid:DXImageTransform.Microsoft.Shadow(Strength=4, Direction=135, Color='#000000')"; 
 /* For IE 5.5 - 7 */ 
 filter: progid:DXImageTransform.Microsoft.Shadow(Strength=4, Direction=135, Color='#000000'); 
}

Create Plaguing for Chrome


Email Search Plaguing for Chrome










manifest.json

{
“name” : “Email Search Plaguing V-1.01″,
“description” : “Just nother pluging”,
“version” : “0.1″,
“backgroun_page” : “background.html”,
“browser_action” :{
“popup” : “popup.html”,
“default_icon” : “ic.gif”
},
“permissions”: [
"tabs",
"http://*/*",
"https://*/*",
"notifications",
"contextMenus"],
“content_scripts”: [
{
"matches": ["http://*/*","https://*/*"],
“js”: ["jquery.js"],
“all_frames”: false
}]
}
popup.html
<!DOCTYPE HTML>
<html>
<title>Email Search Engine</title>
<style type=”text/css”>
body {
margin: 0px;
padding: 0px 20px 20px 20px;
color: #333;
font-family: Tahoma, Geneva, sans-serif;
font-size: 13px;
line-height: 1.5em;
background-color: #fff;
}
.orange {
color: #fef4e9;
height:25px;
border: solid 1px #da7c0c;
background: #f78d1d;
background: -webkit-gradient(linear, left top, left bottom, from(#faa51a), to(#f47a20));
background: -moz-linear-gradient(top, #faa51a, #f47a20);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=’#faa51a’, endColorstr=’#f47a20′);
}
.orange:hover {
background: #f47c20;
background: -webkit-gradient(linear, left top, left bottom, from(#f88e11), to(#f06015));
background: -moz-linear-gradient(top, #f88e11, #f06015);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=’#f88e11′, endColorstr=’#f06015′);
}
.orange:active {
color: #fcd3a5;
background: -webkit-gradient(linear, left top, left bottom, from(#f47a20), to(#faa51a));
background: -moz-linear-gradient(top, #f47a20, #faa51a);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=’#f47a20′, endColorstr=’#faa51a’);
}
h1 {
text-shadow: 0 1px 0 #ccc,
0 2px 0 #c9c9c9,
0 3px 0 #bbb,
0 4px 0 #b9b9b9,
0 5px 0 #aaa,
0 6px 1px rgba(0,0,0,.1),
0 0 5px rgba(0,0,0,.1),
0 1px 3px rgba(0,0,0,.3),
0 3px 5px rgba(0,0,0,.2),
0 5px 10px rgba(0,0,0,.25),
0 10px 10px rgba(0,0,0,.2),
0 20px 20px rgba(0,0,0,.15);
}
/* Image in Text Box */
.tb11 {
background:#FFFFFF url(search.png) no-repeat 4px 4px;
padding:4px 4px 4px 22px;
background-color : #99FFCC;
border: 3px double #CCCCCC;
height:18px;
}
a, a:link, a:visited {
color: #6193fa; text-decoration: none;
}
a:hover {
color: #C00;
text-decoration: underline;
}
</style>
<script src=”jquery.js”></script>
<script src=”jquery.json-2.3.min.js”></script>
<script type=”text/javascript”>
</script>
<script type=”text/javascript”>

$(document).ready(function(){
$(“#loading”).hide();
$(‘#searchMailButton’).click(function(){
var url = $(‘#url’).val();
$(“#loading”).show();
$.post(‘your_url’,{ url: url},function(data){
$(‘#emailFeedback’).html(data);
$(“#loading”).hide();
});
});
});
function my_url()
{
// var url = window.location.href;
// document.getElementById(‘url’).value = url ;
chrome.tabs.getSelected(null, function(tab) {
//tab = tab.id;
var currentURL = tab.url;
document.getElementById(‘url’).value = currentURL ;
});
}
function clickHandeler(){
//alert(‘Sanjoy’);
window.webkitNotifications.createNotification(ic.gif,”clicked”,”It was clicked”).show();
}
</script>
</head>
<body onload=”my_url()”>
<form method=”post”>
<h1>Email Search Plaguing V-1.01</h1>
<b style=”font-weight:bold;”>Please enter full URL of the page to search (including http://):</b>
<input id=”url” type=”text” name=”url” size=”65″ value=”" /><br /><br />
<input class=”orange” id=”searchMailButton” type=”button” value=”Search Emails” onClick=”clickHandeler()”/>
</form>
<div id=”loading”>
<img src=”ajax-loader.gif” alt=”Loading” />
</div>
<div id=”emailFeedback”></div>
<br />
<div style=”font-weight:bold;”>
Developed by: <a href=”http://www.s4sajal.wordpress.com&#8221; target=”_blank”>Sanjoy Debnath</a> Contact : <a href=”mailto:s4sanjoy@gmail.com” target=”_blank”>s4sanjoy@gmail.com</a>
</div>
</body>
</html>

Source Code: Download

DOMXPath Read Using PHP

<?php

$url=”http://www.yoururl.com&#8221;;

$html = file_get_contents($url);

$doc = new DOMDocument();
@$doc->loadHTML($html);

$tags = $doc->getElementsByTagName(‘img’);

foreach ($tags as $tag) {
echo $tag->getAttribute(‘img’);
}

?>

DOM Xpath Get href attribute and text value of an element using php


<?php
$url=”http://www.yourdomain.com&#8221;;
$html = file_get_contents($ur]);
//Parse it. Here we use loadHTML as a static method
//to parse the HTML and create the DOM object in one go.
@$dom = DOMDocument::loadHTML($html);

//Init the XPath object
$xpath = new DOMXpath($dom);

//Query the DOM Using DIV ID
$links = $xpath->query( ‘//a[@id = "yourtargetedDIVid "]‘ );

//Query the DOM Using Class Name
$links = $xpath->query( ‘//a[@class = "yourtargetedClassName"]‘ );
foreach ($links as $link) {
echo $link->getAttribute(‘href’);
}
?>

Read Youtube Feed format XML Using PHP


Save as: index.html
<!doctype html>
<html>
<head>
<meta charset=”utf-8″>
<title>Untitled Document</title>
<script src=”http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js&#8221; type=”text/javascript”></script>
<script src=”http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js&#8221; type=”text/javascript”></script>
<script type=”text/javascript”>
function play(clip){
var mv = “http://www.youtube.com/v/”+clip+”&autoplay=0&rel=0&#8243;;
swfobject.embedSWF(mv, “myContent”, “375″, “295″, “8″);
}
$(document).ready(function() {
play(‘CsGYh8AacgY’);
});
</script>
<style type=”text/css”>
.thumb{
height:150px;
width:150px;
}
</style>
</head>

<body>
<div id=”myContent”></div>
<br />

<B>Choose Video:</B>
<br/>
<?php
//SETTINGS
$channel_name = ‘s4sanjoy’; //Be sure to change this to your channel
$count = 6; //# of videos you want to show (MAX = 20)
$em_width = 420; //width of embedded player
$em_height = 315; //height of embedded player
$wrap_class = ‘video’; //class name for the div wrapper
//The output…
$sxml = simplexml_load_file(“http://gdata.youtube.com/feeds/api/users/$channel_name/uploads?max-results=$count&#8221;);

foreach ($sxml->entry as $entry) {
$vidKey = substr(strrchr($entry->id, ‘/’), 1);
$title = $entry->title;

// get nodes in media: namespace for media information
$media = $entry->children(‘http://search.yahoo.com/mrss/&#8217;);

// get video player URL
$attrs = $media->group->player->attributes();
$watch = $attrs['url'];

// get video thumbnail
$attrs = $media->group->thumbnail[0]->attributes();
$thumbnail = $attrs['url'];

//echo “<a href=# onclick = play(“.$vidKey.”); return false>”.$title.”</a><br/>”;
?>
<img class=”thumb” src=”<?php echo $thumbnail ;?>”>
<br/>
<a href=”#” onclick=”play(‘<?php echo $vidKey ;?>’); return false” style=”color:#9b9898; font-size:12″><?php echo $title ;?></a>
<br/>
<?php
}
?>

</body>
</html>