summaryrefslogtreecommitdiff
path: root/index.php
diff options
context:
space:
mode:
Diffstat (limited to 'index.php')
-rw-r--r--index.php31
1 files changed, 30 insertions, 1 deletions
diff --git a/index.php b/index.php
index 23c314f..c2bb48e 100644
--- a/index.php
+++ b/index.php
@@ -64,8 +64,37 @@ if (strpos($mime, 'text/gemini') === 0) {
}
}
+else if (strpos($mime, 'text') === 0) {
+ echo $response->getBody();
+}
+
else if (strpos($mime, 'image') === 0) {
- echo "<img src=\"data:{$mime};base64," . base64_encode($response->getBody()) . "\">";
+ $src = "data:{$mime};base64," . base64_encode($response->getBody());
+ ?>
+ <img src="<?php echo $src; ?>">
+ <?php
+}
+
+else if (strpos($mime, 'video') === 0) {
+ $src = "data:{$mime};base64," . base64_encode($response->getBody());
+ ?>
+ <video controls>
+ <source src="<?php echo $src; ?>" type="<?php echo $mime; ?>">
+ </video>
+ <?php
+}
+
+else if (strpos($mime, 'audio') === 0) {
+ $src = "data:{$mime};base64," . base64_encode($response->getBody());
+ ?>
+ <audio controls>
+ <source src="<?php echo $src; ?>" type="<?php echo $mime; ?>">
+ </audio>
+ <?php
+}
+
+else {
+ echo "Unhandled MIME type: $mime";
}
echo "<hr>";