HK420
September 20, 2020, 12:06am
1
Ok, so I have some code in ejs:
<div class="blurred-box">
<div class="user-login-box">
<img class="user-icon" src="<%= guild.iconURL() %>">
<div class="user-name"><%= guild.name %></div>
<form style="margin-top: 1em;" method="POST">
<input type="text" name="prefix" value="<%= settings.prefix %>" placeholder="Prefix" class="user-password" /><br><br>
<button class="button1" type="submit" onclick="alertsave()"style="color: black;">Save Settings</button>
</div>
</form>
<%- include("partials/footer") %>
</div>
And for some reason sometimes it works and sometimes is doesn’t.
It also seems like it only works for some guilds.
Please help!!
Daw588
September 20, 2020, 12:08am
2
Maybe because of their format (.png
, .jpg
, .webp
). I am not quiet sure.
what’s the link look like? If its an .svg file, it might not work
HK420
September 20, 2020, 12:08am
4
I tried changing the format but it didn’t work.
Can you just console.log iconURL and send it here?
1 Like
HK420
September 20, 2020, 12:11am
7
CarlyRaeJepsenStan:
console.log
Ok so, I tried console.logging it and it came up with an image url for the images that successfully loaded but nothing came up for the one that didn’t load.
It’s probably a backend code error then - did you check if the guild ID and all that are correct?
Maybe that guild doesn’t exist or something. Idk …
HK420
September 20, 2020, 12:15am
11
Ok, it’s fine, thanks anyways.
1 Like
The worst errors are whens something just “doesn’t work” and there’s no reason why
Daw588
September 20, 2020, 12:20am
13
I would do some debugging then.
Maybe check if guild
object exists… or whatever that is associated with the part of the code that takes the server icon.
Maybe wait for the image to load before displaying it?
3 Likes
maybe you could use the async EJS attr