summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2025-06-12 02:46:34 +0500
committerilotterytea <iltsu@alright.party>2025-06-12 02:46:34 +0500
commit6140ce63a3516406db54a3e9abfd5b96a3fdd166 (patch)
treefc4559bd68b84d1ea57588289ba4dbe4acf63309
parent3415d5f5abb90cba225af9fbb9eed4349abe3cd1 (diff)
feat: base64 option
-rw-r--r--public/generate.php18
1 files changed, 15 insertions, 3 deletions
diff --git a/public/generate.php b/public/generate.php
index 6226c8f..bd539c7 100644
--- a/public/generate.php
+++ b/public/generate.php
@@ -112,7 +112,19 @@ $screenshot = generate_message_screenshot(
imagedestroy($pfp);
imagedestroy($old_pfp);
-header('Content-Type: image/jpeg');
-header("Content-Disposition: inline; filename*=UTF-8''message-{$username}-{$message_id}-{$channel_login}.jpg");
-imagejpeg($screenshot);
+if (isset($_GET['base64'])) {
+ ob_start();
+ imagejpeg($screenshot);
+ $image_data = ob_get_contents();
+ ob_end_clean();
+
+ $image_data = base64_encode($image_data);
+
+ echo "data:image/jpeg;base64,{$image_data}";
+} else {
+ header('Content-Type: image/jpeg');
+ header("Content-Disposition: inline; filename*=UTF-8''message-{$username}-{$message_id}-{$channel_login}.jpg");
+ imagejpeg($screenshot);
+}
+
imagedestroy($screenshot); \ No newline at end of file