-
Notifications
You must be signed in to change notification settings - Fork 0
/
artist.php
executable file
·56 lines (50 loc) · 1.89 KB
/
artist.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
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
<?php
require 'includes/script.php';
$lastfm = new LastFM("092d316884d8385f35ad8b84f5f42ef8");
error_reporting(E_ALL ^ E_WARNING);
$artist = $_GET['artist'];
if ($artist != null):
$artistInfo = $lastfm->getArtistInfo(str_replace(' ','+', $artist));
endif;
$image = $lastfm->getImage($artist);
foreach ($image->photos->photo as $photo) {
$url = 'http://farm' . $photo->farm . '.staticflickr.com/'. $photo->server . '/' . $photo->id . '_' . $photo->secret . '.jpg';
}
?>
<!-- Loads a different artist based on what was clicked from the index page -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="includes/style.css">
<title><?= $artist ?></title>
<form>
<input id="back" type="button" value="back" onclick="history.go(-1)">
</form>
</head>
<body>
<div class="artist-title">
<?php if ($artist === null): ?>
<h1>artist not found.</h1>
<?php else: ?>
<br>
<div id="track-name"><?= $artist ?></div>
<br>
<?php endif; ?>
</div>
<div class="information">
<div class="album-picture">
<img src="<?= $url ?>" alt="unable to load" style="height:200px; bottom:720px; border: 5px solid #000; float:right;">
</div>
<div class="album-information">
<?php foreach($artistInfo->artist as $k=>$v):
foreach($v->bio as $f=>$g):
$string = substr($g->summary, 0, strpos($g->summary, "<a"))?>
<?= $string; ?>
<?php endforeach;
endforeach; ?>
</div>
</div>
</body>
</html>