Best resolution

This commit is contained in:
Mattia Mascarello 2022-08-26 04:06:44 +02:00 committed by GitHub
parent 19bf6aedcf
commit 0398569f7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -59,19 +59,18 @@ function flagGetFromUser($p){
} }
function dlImage($userId,$fileName){ function dlImage($userId,$fileName){
$r=API("getUserProfilePhotos", ["user_id" => $userId]); $r=API("getUserProfilePhotos", ["user_id" => $userId]);
$n=$r["result"]["photos"]; $n=$r["result"]["photos"];
$a=0;//count($n)-1; $a=0;//photo num
$b=count($n[$a])-1; $b=count($n[$a])-1;
$file_id=$r["result"]["photos"][0][0]["file_id"]; $file_id=$r["result"]["photos"][0][$b]["file_id"];
if($file_id==null){ if($file_id==null){
copy("gdImg/default.jpg",$fileName); copy("gdImg/default.jpg",$fileName);
return 0; return 0;
} }
$fO=API("getFile", ["file_id" => $file_id]); $fO=API("getFile", ["file_id" => $file_id]);
//file_put_contents("Dda",json_encode($fO, JSON_PRETTY_PRINT));
$fu="https://api.telegram.org/file/".$GLOBALS["config"]["lgbt"]["TOKEN"]."/".$fO["result"]["file_path"]; $fu="https://api.telegram.org/file/".$GLOBALS["config"]["lgbt"]["TOKEN"]."/".$fO["result"]["file_path"];
unlink($fileName); unlink($fileName);
$ch = curl_init($fu); $ch = curl_init($fu);