Notifications
Sign Up Sign In
Q&A

Welcome to Codidact Meta!

Codidact Meta is the meta-discussion site for the Codidact community network and the Codidact software. Whether you have bug reports or feature requests, support questions or rule discussions that touch the whole network – this is the site for you.

Serve images with file extensions

+3
−0

I've noticed that images uploaded to Codidact don't retain any meta information. That is, they don't keep either the name of the image or the image extension.

While the former isn't that bad (alt text or just plain explanation is probably better if information about the image is needed), the latter is troubling. There is no way to know what the type of the image is, whether it's a png, jpg, or other.

Browsers are able to guess the extension and display the image, but when it comes to saving, Edge and Chrome will only offer the name the site gives the image - that is, without an extension. Firefox can automatically add the extension it guessed to the file name when saving, but either way, I don't think the site should rely on browsers needing to guess the image extension.

Thus, I suggest either

  • The entire image name is saved. If name collisions are a problem, you can keep the hash thing in the URL, ex. .../9FJw5ge4D2CAh2NsTz3iPF3U/<image name>.png
  • The extension is saved (so .../9FJw5ge4D2CAh2NsTz3iPF3U.png)
Why should this post be closed?

2 comments

We do technically have the filename, it's just not used... I'm not sure whether this is easy or hard, because image storage is not something we have direct code control over. ‭‮edoCfOtrA‭ about 1 month ago

@ArtOfCode I thought as much, since the image is on the amazon aws domain instead of the codidact domain. ‭Moshi‭ about 1 month ago

0 answers

Sign up to answer this question »