Get servergroup icon

Alw7SHxD

Member
Sep 18, 2015
12
0
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
Jun 9, 2016
277
111
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
Sep 18, 2015
12
0
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
Jan 1, 2016
459
286
122

Alw7SHxD

Member
Sep 18, 2015
12
0
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
Oct 22, 2015
12
0
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
Sep 18, 2015
12
0
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
Sep 18, 2015
12
0
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
Sep 18, 2015
12
0
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
Jul 18, 2015
635
588
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
Sep 18, 2015
12
0
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
Sep 18, 2015
12
0
39
One last question though, is there a way to get every single servergroup id and put it in an array?
 
Top