This repository has been archived on 2024-09-05. You can view files and clone it, but cannot push or open issues or pull requests.
shimmie2/ext/handle_mp3/theme.php

32 lines
925 B
PHP
Raw Normal View History

2021-12-14 18:32:47 +00:00
<?php
declare(strict_types=1);
namespace Shimmie2;
use function MicroHTML\{SCRIPT};
class MP3FileHandlerTheme extends Themelet
{
public function display_image(Image $image): void
{
2024-01-01 21:17:36 +00:00
global $page;
$data_href = get_base_href();
$ilink = $image->get_image_link();
$html = "
<audio controls class='shm-main-image audio_image' id='main_image' alt='main image'>
2024-01-28 21:24:21 +00:00
<source id='audio_src' src=\"$ilink\" type=\"audio/mpeg\">
Your browser does not support the audio element.
</audio>
<p>Title: <span id='audio-title'>???</span> | Artist: <span id='audio-artist'>???</span></p>
<p><a href='$ilink' id='audio-download'>Download</a>";
$page->add_html_header(SCRIPT([
'src' => "$data_href/ext/handle_mp3/lib/jsmediatags.min.js",
'type' => 'text/javascript'
]));
$page->add_block(new Block("Music", $html, "main", 10));
}
}