summaryrefslogtreecommitdiff
path: root/public/account/login/twitch.php
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2025-04-29 02:06:11 +0500
committerilotterytea <iltsu@alright.party>2025-04-29 02:06:11 +0500
commit93c02436fb0b7afffb6c62547385757b1a1b57f8 (patch)
treeb60ccd0a1df6076f97c3898d952ec3262dff34d7 /public/account/login/twitch.php
parentc95dfa9e3dd18c0835626ec29b814cc2b11b7fae (diff)
feat: download user's profile banner
Diffstat (limited to 'public/account/login/twitch.php')
-rw-r--r--public/account/login/twitch.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/public/account/login/twitch.php b/public/account/login/twitch.php
index ec10583..1c72bc3 100644
--- a/public/account/login/twitch.php
+++ b/public/account/login/twitch.php
@@ -139,4 +139,23 @@ if (!is_file("$path/$user_id")) {
fclose($fp);
}
+// downloading profile banner
+$path = "../../static/userdata/banners";
+
+if (!is_dir($path)) {
+ mkdir($path, 0777, true);
+}
+
+if (!is_file("$path/$user_id")) {
+ $fp = fopen("$path/$user_id", "wb");
+ $request = curl_init();
+ curl_setopt($request, CURLOPT_URL, $twitch_user["offline_image_url"]);
+ curl_setopt($request, CURLOPT_FILE, $fp);
+ curl_setopt($request, CURLOPT_HEADER, 0);
+
+ curl_exec($request);
+ curl_close($request);
+ fclose($fp);
+}
+
header("Location: /account"); \ No newline at end of file