bmarian / chat-images

A module for Foundry VTT that adds image support for the chat.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Suggestion: Upload images to server data folder instead of embedding them in the chat message

Moerill opened this issue · comments

Heya
Totally loving this module, but it has one big disadvantage:
As far as i've seen it, you're embedding images into the chat messages instead of uploading them to the server. This results in possibly drastically increasing the world size, specifically the chat.db file.
This is actually kind of a problem for the server, especially for those at the lower end. Related issue on the FVTT gitlab:
https://gitlab.com/foundrynet/foundryvtt/-/issues/3445

My suggestion:
Upload the images to the server and only link to the images there, instead of embedding them in the html. (either let the user set an upload path and/or default to the module folder. Second one has the disadvantage of stuff disappearing on update, but since this module is kinda finished, this shouldn't be to big of a problem if the user is warned of this beforehand)

As for naming these files i'd have two ideas:

  1. just increase the number (check in the folder for biggest number and increase it, do not rely on a setting, cause of different worlds possibly sharing the same path)
  2. hash the original file name (or the content) into some name.

Oh. Thanks for the suggestion, I tried to avoid cluttering the server with random images. But it looks like there is no other option.

The current way does clutter it as well, just not as obvious 😅 (as well as clutter client side while playing)
Just make sure the user knows that you're uploading stuff (hint in description/path selection/whatever) and you're fine imo.