git.cweiske.de
/
gamestick-pjgsapi.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
1fb03bf
)
Support png avatars
author
Christian Weiske
<cweiske@cweiske.de>
Mon, 12 Jun 2023 18:33:46 +0000
(20:33 +0200)
committer
Christian Weiske
<cweiske@cweiske.de>
Mon, 12 Jun 2023 18:33:46 +0000
(20:33 +0200)
src/Profile.php
patch
|
blob
|
history
diff --git
a/src/Profile.php
b/src/Profile.php
index ca204ac7909fb45fb92192754b322c4643df4803..e120546750d44e2753fe1c73a7d530e5532faa2d 100644
(file)
--- a/
src/Profile.php
+++ b/
src/Profile.php
@@
-4,6
+4,8
@@
*/
class Profile
{
*/
class Profile
{
+ protected string $avatarDir;
+
public int $id;
public string $hwId;
public string $sessionId;
public int $id;
public string $hwId;
public string $sessionId;
@@
-16,6
+18,11
@@
class Profile
public string $created_at;
public string $created_at;
+ public function __construct()
+ {
+ $this->avatarDir = dirname(__FILE__) . '/../www/resources/avatars/';
+ }
+
public function complete(): bool
{
return $this->gamerTag !== null;
public function complete(): bool
{
return $this->gamerTag !== null;
@@
-26,8
+33,15
@@
class Profile
if (strpos($this->avatar, '://')) {
return $this->avatar;
}
if (strpos($this->avatar, '://')) {
return $this->avatar;
}
+
+ if (file_exists($this->avatarDir . $this->avatar . '.large.jpg')) {
+ $ext = 'jpg';
+ } else {
+ $ext = 'png';
+ }
+
return 'http://l2.gamestickservices.net/resources/avatars/'
return 'http://l2.gamestickservices.net/resources/avatars/'
- . $this->avatar . '.large.
jpg'
;
+ . $this->avatar . '.large.
' . $ext
;
}
public function getAvatarSmallUrl(): string
}
public function getAvatarSmallUrl(): string
@@
-35,7
+49,14
@@
class Profile
if (strpos($this->avatar, '://')) {
return $this->avatar;
}
if (strpos($this->avatar, '://')) {
return $this->avatar;
}
+
+ if (file_exists($this->avatarDir . $this->avatar . '.small.jpg')) {
+ $ext = 'jpg';
+ } else {
+ $ext = 'png';
+ }
+
return 'http://l2.gamestickservices.net/resources/avatars/'
return 'http://l2.gamestickservices.net/resources/avatars/'
- . $this->avatar . '.small.
jpg'
;
+ . $this->avatar . '.small.
' . $ext
;
}
}
}
}