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
|
<!DOCTYPE html>
<html>
<head>
<script language="javascript" src="svgconverter.js">
</script>
<link rel="stylesheet" type="text/css" href="svgconverter.css">
</head>
<body>
<table><tr>
<td id='preview'>
<?php
function endsWith($haystack, $needle, $case=true) {
if($case){
return( strcmp( substr( $haystack, strlen( $haystack ) - strlen( $needle )), $needle ) === 0 );
}
return( strcasecmp( substr( $haystack, strlen( $haystack) - strlen( $needle )), $needle ) === 0 );
}
$dir = opendir( '../media/svgconverter' );
while(( $file = readdir( $dir )) !== false ) {
if( endsWith( $file, ".svg" )) {
echo "<span onmouseover='this.style.backgroundColor=\"#000\";this.style.color=\"#fff\"' onmouseout='this.style.backgroundColor=\"#fff8f8\";this.style.color=\"#000\"' style='cursor:pointer;' onclick='getSVG(\"".$file."\");'>".$file."</span><br>";
}
}
?>
</td>
<td id='preview'>
Preview:<br>
<canvas width="700" height="700" id="previewCanvas">
</canvas>
</td>
<td id='preview'>
<pre id='content'>
</pre>
</td>
</tr></table>
</body>
</html>
|