Get servergroup icon

Alw7SHxD

Member
Joined
Sep 18, 2015
Messages
12
Reaction score
0
Points
39
Hey there, i'm doing a script that shows the client thier own servergroups that's assigned to them, i have their uuid, database id, servergroups id(s) inside an array, the problem is how to get the actual icons? or how to download it to a certain directory.
 

FarisDev

L oryh brx
Contributor
Joined
Jun 9, 2016
Messages
277
Reaction score
111
Points
107
You could make a folder called: icons and put all icons on it like member.png ...
And make: if in array..... etc.
if he's have a server group called (Member) you should make echo "<img src="member.png"></img>"
I happy that's you want.
If you didn't know & need help come PM.
 
Last edited:

Alw7SHxD

Member
Joined
Sep 18, 2015
Messages
12
Reaction score
0
Points
39
You could make a folder called: icons and put all icons on it like member.png ...
And make: if in array..... etc.
if he's have a server group called (Member) you should make echo "<img src="member.png"></img>"
I happy that's you want.
If you didn't know & need help come PM.
I know i could do that, but i need it to be automatic, so if i add a new servergroup i don't have to manually do it.
 

Kieran

Tag me
Contributor
Joined
Jan 1, 2016
Messages
459
Reaction score
286
Points
122

Alw7SHxD

Member
Joined
Sep 18, 2015
Messages
12
Reaction score
0
Points
39
Code:
header('Content-type: image/png');
echo $virtualServer->serverGroupGetById(6)->iconDownload();
Great! That works, Now i'm confused on how to display multiple icons and not just one, also place those icons within a normal html site, all using this method. But is it possible?
 

rommel23

Member
Joined
Oct 22, 2015
Messages
12
Reaction score
0
Points
38
Maybe you can try with foreach. I didn't tested it but it may work.

From PHP.NET:
<?php
$arr = array(1, 2, 3, 4);
foreach ($arr as $value) {
echo $virtualServer->serverGroupGetById($value)->iconDownload()
}
?>
 

Alw7SHxD

Member
Joined
Sep 18, 2015
Messages
12
Reaction score
0
Points
39
Maybe you can try with foreach. I didn't tested it but it may work.

From PHP.NET:
<?php
$arr = array(1, 2, 3, 4);
foreach ($arr as $value) {
echo $virtualServer->serverGroupGetById($value)->iconDownload()
}
?>
I tried that out... But the result was terrible :D so still nothing works..
 

Alw7SHxD

Member
Joined
Sep 18, 2015
Messages
12
Reaction score
0
Points
39
Still, didn't find a way to do it..
 
Last edited:

Alw7SHxD

Member
Joined
Sep 18, 2015
Messages
12
Reaction score
0
Points
39
You can make it like This: yourdomain.com/icon.php?id=The ID Of the servergroup With $_GET['id'];
Tutorial $_GET: https://www.w3schools.com/php/php_forms.asp
Let me clear things up a little bit, firstly my script is getting the connected client information such as their UUID, servergroups, etc.. i have a function that's does: foreach value(sgid) which is in an array ( servergroups array ), now the step that's more important is.. how to display those icons within the html/php page itself so the client could view their servergroups icons, i know that i could store those icons in a directory manually, but i want to make it that it get's the icons automatically even if you make a new servergroup. the thing is i'm confused on how to actually display those icons without having to put image header. but i want it within an actual html/php page that displays the client's username, and their servergroups..
 

Alw7SHxD

Member
Joined
Sep 18, 2015
Messages
12
Reaction score
0
Points
39
Okay, for now i'm going to stick with putting it manually, but i still hope to find a solution for making it automatically get icons.
 

Norvik

Retired Staff
Contributor
Joined
Jul 18, 2015
Messages
635
Reaction score
588
Points
157
Okay, for now i'm going to stick with putting it manually, but i still hope to find a solution for making it automatically get icons.
Why wouldn't you use @SpeciaL's idea?
Code:
<img src="yourdomain.com/icon.php?id=<?php echo $groupID; ?>">

While icon php does this:
Code:
header('Content-type: image/png');
echo $virtualServer->serverGroupGetById($_GET['id'])->iconDownload();
 

Alw7SHxD

Member
Joined
Sep 18, 2015
Messages
12
Reaction score
0
Points
39
Why wouldn't you use @SpeciaL's idea?
Code:
<img src="yourdomain.com/icon.php?id=<?php echo $groupID; ?>">

While icon php does this:
Code:
header('Content-type: image/png');
echo $virtualServer->serverGroupGetById($_GET['id'])->iconDownload();
So i created a new file to get the icon using the $_GET and the first method, then in a function i turned the file into a URi since i didn't know how to implement the image without displaying the _GET param...
Problem Solved :D
 

Alw7SHxD

Member
Joined
Sep 18, 2015
Messages
12
Reaction score
0
Points
39
One last question though, is there a way to get every single servergroup id and put it in an array?
 

Kleberstoff

Knowledge Seeker
VIP
Joined
Dec 29, 2015
Messages
308
Reaction score
214
Points
158
One last question though, is there a way to get every single servergroup id and put it in an array?

Code:
  $sGroups = $ts3Server->servergroupList();
   foreach($sGroups as $group)
   {
       echo $group['sgid'];
   }
 
Top