mirror of
https://github.com/openvk/openvk
synced 2024-12-23 00:51:03 +03:00
Use adler32 hash for app avatars (php74 compat)
This commit is contained in:
parent
59cb20628f
commit
b328254285
1 changed files with 3 additions and 3 deletions
|
@ -74,14 +74,14 @@ class Application extends RowModel
|
||||||
case "basic":
|
case "basic":
|
||||||
return "$serverUrl/blob_" . substr($hash, 0, 2) . "/$hash" . "_app_avatar.png";
|
return "$serverUrl/blob_" . substr($hash, 0, 2) . "/$hash" . "_app_avatar.png";
|
||||||
case "accelerated":
|
case "accelerated":
|
||||||
return "$serverUrl/openvk-datastore/$hash.app_avatar.png";
|
return "$serverUrl/openvk-datastore/$hash" . "_app_avatar.png";
|
||||||
case "server":
|
case "server":
|
||||||
$settings = (object) OPENVK_ROOT_CONF["openvk"]["preferences"]["uploads"]["server"];
|
$settings = (object) OPENVK_ROOT_CONF["openvk"]["preferences"]["uploads"]["server"];
|
||||||
return (
|
return (
|
||||||
$settings->protocol ?? ovk_scheme() .
|
$settings->protocol ?? ovk_scheme() .
|
||||||
"://" . $settings->host .
|
"://" . $settings->host .
|
||||||
$settings->path .
|
$settings->path .
|
||||||
substr($hash, 0, 2) . "/$hash.app_avatar.png"
|
substr($hash, 0, 2) . "/$hash" . "_app_avatar.png"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -205,7 +205,7 @@ class Application extends RowModel
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
$hash = hash_file("murmur3a", $file["tmp_name"]);
|
$hash = hash_file("adler32", $file["tmp_name"]);
|
||||||
if(!is_dir($this->getAvatarsDir() . substr($hash, 0, 2)))
|
if(!is_dir($this->getAvatarsDir() . substr($hash, 0, 2)))
|
||||||
if(!mkdir($this->getAvatarsDir() . substr($hash, 0, 2)))
|
if(!mkdir($this->getAvatarsDir() . substr($hash, 0, 2)))
|
||||||
return -3;
|
return -3;
|
||||||
|
|
Loading…
Reference in a new issue