-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetIconDiv.php
More file actions
128 lines (88 loc) · 2.12 KB
/
getIconDiv.php
File metadata and controls
128 lines (88 loc) · 2.12 KB
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
<?
function parse_query($var)
{
/**
* Use this function to parse out the query array element from
* the output of parse_url().
*/
$var = parse_url($var, PHP_URL_QUERY);
$var = html_entity_decode($var);
$var = explode('&', $var);
$arr = array();
foreach($var as $val)
{
$x = explode('=', $val);
$arr[$x[0]] = $x[1];
}
unset($val, $x, $var);
return $arr;
}
$x = $_GET["x"];
$y = $_GET["y"];
$url = $_GET["url"];
$iconDivStyle = array();
$iconDivStyle["position"] = "absolute";
////////
// Width and height should divide 250
////////
$width = 125;
$height = 50;
$iconDivStyle["width"] = $width."px";
$iconDivStyle["height"] = $height."px";
/*
$apparentLeft = ($x - ($width / 2));
$apparentTop = ($y - ($height / 2));
*/
$actualLeft = $x - ($x % $width);
$actualTop = $y - ($y % $height);
$iconDivStyle["left"] = $actualLeft."px";
$iconDivStyle["top"] = $actualTop."px";
$iconUrl = "http://www.blogger.com/favicon.ico";
$iconImgStyle = array();
$iconImgStyle["border"] = "0px";
$iconImgStyle["position"] = "absolute";
$iconImgStyle["top"] = "5px";
$iconImgStyle["left"] = "5px";
//$iconImgStyle["width"] = "100%";
//$iconImgStyle["height"] = "100%";
$overlayImgStyle = array();
$overlayImgStyle["position"] = "absolute";
$overlayImgStyle["border"] = "0px";
$overlayImgStyle["top"] = "0px";
$overlayImgStyle["left"] = "0px";
$overlayImgStyle["width"] = "100%";
$overlayImgStyle["height"] = "100%";
$urlComponents = parse_url($url);
$queryParts = parse_query($url);
//print_r($queryParts);
if (array_key_exists("v", $queryParts))
{
$videoId = $queryParts["v"];
}
//$iconUrl = "http://i2.ytimg.com/vi/$videoId/default.jpg";
$targetFrame = $_GET["targetFrame"];
//print $targetFrame;
?>
<div style="<?
foreach ($iconDivStyle as $key=>$value)
{
print "$key:$value;";
}
?>">
<a href="<? print $url; ?>" target="<? print $targetFrame; ?>" onclick="">
<img style="<?
foreach ($iconImgStyle as $key=>$value)
{
print "$key:$value;";
}
?>" src="<? print $iconUrl; ?>"></img>
<img style="<?
foreach ($overlayImgStyle as $key=>$value)
{
print "$key:$value;";
}
?>" src="img/canvas.png"></img>
</a>
</div>
<?
?>