2021-12-14 18:32:47 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
2020-08-28 14:11:14 +00:00
|
|
|
|
2023-01-10 22:44:09 +00:00
|
|
|
namespace Shimmie2;
|
|
|
|
|
2024-01-19 18:57:02 +00:00
|
|
|
use function MicroHTML\{rawHTML};
|
|
|
|
|
2020-08-28 14:11:14 +00:00
|
|
|
class TranscodeVideoTheme extends Themelet
|
|
|
|
{
|
2024-01-20 14:10:59 +00:00
|
|
|
/**
|
2020-08-28 14:11:14 +00:00
|
|
|
* Display a link to resize an image
|
2024-01-20 14:10:59 +00:00
|
|
|
*
|
|
|
|
* @param array<string, string> $options
|
2020-08-28 14:11:14 +00:00
|
|
|
*/
|
2024-01-19 18:57:02 +00:00
|
|
|
public function get_transcode_html(Image $image, array $options): \MicroHTML\HTMLElement
|
2020-08-28 14:11:14 +00:00
|
|
|
{
|
2024-02-10 01:55:05 +00:00
|
|
|
$html = make_form(
|
2020-08-28 14:11:14 +00:00
|
|
|
make_link("transcode_video/{$image->id}"),
|
2024-02-10 01:55:05 +00:00
|
|
|
//onsubmit: "return transcodeSubmit()"
|
2020-08-28 14:11:14 +00:00
|
|
|
)."
|
|
|
|
<input type='hidden' name='codec' value='{$image->video_codec}'>
|
|
|
|
".$this->get_transcode_picker_html($options)."
|
|
|
|
<br><input id='transcodebutton' type='submit' value='Transcode Video'>
|
|
|
|
</form>
|
|
|
|
";
|
|
|
|
|
2024-01-19 18:57:02 +00:00
|
|
|
return rawHTML($html);
|
2020-08-28 14:11:14 +00:00
|
|
|
}
|
|
|
|
|
2024-01-20 14:10:59 +00:00
|
|
|
/**
|
|
|
|
* @param array<string, string> $options
|
|
|
|
*/
|
2021-03-14 23:43:50 +00:00
|
|
|
public function get_transcode_picker_html(array $options): string
|
2020-08-28 14:11:14 +00:00
|
|
|
{
|
|
|
|
$html = "<select id='transcode_format' name='transcode_format' required='required' >";
|
2023-11-11 21:49:12 +00:00
|
|
|
foreach ($options as $display => $value) {
|
2020-08-28 14:11:14 +00:00
|
|
|
$html .= "<option value='$value'>$display</option>";
|
|
|
|
}
|
|
|
|
return $html."</select>";
|
|
|
|
}
|
|
|
|
|
2021-03-14 23:43:50 +00:00
|
|
|
public function display_transcode_error(Page $page, string $title, string $message): void
|
2020-08-28 14:11:14 +00:00
|
|
|
{
|
|
|
|
$page->set_title("Transcode Video");
|
|
|
|
$page->set_heading("Transcode Video");
|
|
|
|
$page->add_block(new NavBlock());
|
|
|
|
$page->add_block(new Block($title, $message));
|
|
|
|
}
|
|
|
|
}
|