Skip to content

Commit 370c83b

Browse files
committed
favicon
1 parent 32349f5 commit 370c83b

5 files changed

Lines changed: 22 additions & 1 deletion

File tree

src/WampClient.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,25 @@ public function actionCss()
6868
readfile(__DIR__.'/css/WampClient.css');
6969
}
7070

71+
/**
72+
* Output Img
73+
*
74+
* @return void
75+
*/
76+
public function actionImg()
77+
{
78+
$src = isset($_GET['src']) ? $_GET['src'] : null;
79+
$srcSanitized = __DIR__.'/img/'.str_replace('..', '', $src);
80+
if ($src && file_exists($srcSanitized)) {
81+
header('Content-Type: image/png');
82+
header('Content-Disposition: inline; filename="'.rawurlencode(basename($srcSanitized)).'"');
83+
header('Content-Length: '.filesize($srcSanitized));
84+
readfile($srcSanitized);
85+
} else {
86+
header("HTTP/1.0 404 Not Found");
87+
}
88+
}
89+
7190
/**
7291
* Output Javascript
7392
*

src/img/favicon-16x16.png

647 Bytes
Loading

src/img/favicon-32x32.png

1.06 KB
Loading

src/img/favicon.ico

14.7 KB
Binary file not shown.

src/views/index.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
66
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" crossorigin="anonymous"></script>
77
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" crossorigin="anonymous" />
8-
<link id="wampClientCss" rel="stylesheet" href="?action=css">
8+
<link id="wampClientCss" rel="stylesheet" href="?action=css" />
9+
<link rel="icon" type="image/png" sizes="32x32" href="?action=img&amp;src=favicon-32x32.png" />
10+
<link rel="icon" type="image/png" sizes="16x16" href="/action=img&amp;src=favicon-16x16.png" />
911
</head>
1012
<body>
1113

0 commit comments

Comments
 (0)