DVinyl icon indicating copy to clipboard operation
DVinyl copied to clipboard

[Feature]: Optionally store external images locally

Open ArtwoXYZ opened this issue 3 months ago • 6 comments

Before suggesting

  • [x] I searched the existing issues and did not find a similar request.

What problem would this solve?

DVinyl now stores uploaded item images as local files and includes them in portable ZIP backups. However, images added through a URL or selected from a search provider are still stored as external links.

Those links may eventually break because of deleted files, expiring CDN URLs, hotlink protection or provider changes. When this happens, the image disappears from the item and is not recoverable from a backup.

It would be useful to optionally download external images to the DVinyl server, making them as reliable and portable as regular uploads.

How could it work?

Settings and plugin overrides

My preferred behavior would be an instance-level setting, disabled by default:

Download external images to the server

Each plugin could optionally override this setting with three possible values:

  • use the instance setting
  • always download external images
  • always keep external URLs

The plugin setting would take priority over the instance setting.

Existing external images

When local downloading is enabled, it should apply both to newly selected images and to external images already stored in the affected collections.

Existing images could be migrated by a background task with progress reporting. Disabling the setting later would stop future downloads but would not delete images that were already stored locally.

Download and replacement flow

For each image, DVinyl would:

  1. keep the external URL while attempting the download
  2. download and validate the image server-side
  3. resize and normalize it using the same limits as local uploads
  4. store it under /uploads/items/
  5. replace the URL only after the local file has been saved successfully

If the download fails, the original URL would remain unchanged and the failure would be reported.

I do not think the original URL needs to be preserved after a successful migration, unless there is a useful recovery or attribution reason I have overlooked.

Storage and safety limits

Migrating every existing external image could require significant disk space and network traffic, so some safeguards would be needed:

  • confirmation showing how many images will be processed
  • per-image size and timeout limits
  • limited download concurrency
  • a configurable storage limit or minimum free-disk threshold
  • progress and failure reporting
  • stopping safely without replacing URLs whose download failed

WebP as the new local format

As part of this change, I would also suggest making WebP the default format for every new image stored locally by DVinyl.

The current local upload flow converts images to JPEG. WebP would provide a better common format because it supports transparency while generally producing smaller files for covers, posters and photographic artwork.

This would apply consistently to:

  • images uploaded from a device
  • external URLs downloaded by DVinyl
  • images selected from search providers and stored locally

Existing JPEG files would remain fully supported and would not need to be migrated or recompressed. The storage, validation, cleanup and ZIP backup systems would simply be extended to support both existing .jpg files and new .webp files.

Feedback and implementation

This is the direction I would personally suggest.

Does this overall behavior seem appropriate, especially the instance/plugin priority, the migration of existing external images and making WebP the default for newly stored images?

I could take care of the implementation once the expected behavior has been agreed on.

Alternatives you considered

Keeping external links is simpler and uses no local storage, but images remain dependent on third-party websites and cannot be included in portable backups.

Would you like to help build it?

I could open a PR for it

ArtwoXYZ avatar Aug 31 '26 23:08 ArtwoXYZ

hi! yeah! I need some time to think about the idea and consider the new image system you suggested ;)

Kyonew avatar Sep 01 '26 21:09 Kyonew

hi! yeah! I need some time to think about the idea and consider the new image system you suggested ;)

I had to do this for the yu-gi-oh api so you could check that out

Siebe-Uy avatar Sep 02 '26 10:09 Siebe-Uy

hello @ArtwoXYZ ! Hope you're doing well

I finally have a little time to spend on DVinyl xD I'm on board with the idea. A couple of things I'd change though. The setting should be an instance one with a per-collection override rather than a per-plugin one, since disk space is really the instance owner's call. And the resizing step doesn't exist server-side today (it all happens in the browser before upload), so I'd rather just validate and cap the size than pull in a new image library.

One thing that's not in the issue and matters a lot: having the server fetch a URL a user typed opens it up to being used to probe the machine's own network, so that needs proper guarding before anything ships.

Would you be up for splitting it? New images first, then the migration of existing ones, then WebP separately; that last one touches the backup format and an old version wouldn't be able to read the new files, so it deserves its own PR.

Really appreciate you offering to build it <3

Kyonew avatar Sep 16 '26 16:09 Kyonew

Yeah, I’m totally on board with that! I actually think your approach is even better and cleaner than what I originally had in mind.

And no problem at all with splitting the work into multiple PRs as you suggested, that makes sense to me.

I should be able to get back to working on it starting next week 👍

ArtwoXYZ avatar Sep 16 '26 20:09 ArtwoXYZ

Hey @ArtwoXYZ! Since I hadn't heard back in a while, I built both this and #151 part 2 on the release branch, following your plan. You're credited for both in the 4.0.0 notes. Sorry if you had work in progress, and thanks a lot for the design <3

Kyonew avatar Nov 15 '26 17:11 Kyonew

Hi! 4.0.0 is out with local image copies (off by default, per-collection override). Thanks again for the design!

Kyonew avatar Nov 15 '26 17:11 Kyonew