-
Notifications
You must be signed in to change notification settings - Fork 0
/
ajax.php
30 lines (28 loc) · 1.17 KB
/
ajax.php
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
<?php
if (isset($_POST["url"]))
{
$videoURL=strip_tags($_POST["url"]);
$thumbnailSize=strip_tags($_POST["thumbSize"]);
if (preg_match('%(?:youtube(?:-nocookie)?.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu.be/)([^"&?/ ]{11})%i', $videoURL, $id))
{
$videoId = $id[1];
echo '<br><div class="panel panel-success">
<div class="panel-heading text-center">
<b><i class="fa fa-check" aria-hidden="true"></i> Thumbnail has been generated</b>
</div>
<div class="panel-body">
<center>
<a href="download.php?file=http://img.youtube.com/vi/'.$videoId.'/'.$thumbnailSize.'.jpg"><img src="http://img.youtube.com/vi/'.$videoId.'/'.$thumbnailSize.'.jpg" class="img-responsive" /></a>
</center>
</div>
<div class="panel-footer">
<a href="download.php?file=http://img.youtube.com/vi/'.$videoId.'/'.$thumbnailSize.'.jpg" class="text-center btn btn-success btn-block btn-lg"><i class="fa fa-download" aria-hidden="true"></i> Download this thumbnail</a>
</div>
</div><br><br>';
}
else
{
return false;
}
}
?>