guild.iconURL() not working for some images

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.
image

image

It also seems like it only works for some guilds.

Please help!!

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

I tried changing the format but it didn’t work.

Can you just console.log iconURL and send it here?

1 Like

Ok, wait a sec.

1 Like

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?

Everything is working…

Maybe that guild doesn’t exist or something. Idk …

Ok, it’s fine, thanks anyways.

1 Like

The worst errors are whens something just “doesn’t work” and there’s no reason why :frowning:

image

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