earlSt1 / vtt-compendium-folders

Collapsable folders in the compendium directory and folder structures inside compendiums for FoundryVTT
21 stars 18 forks source link

Exporting Scenes in folder structure to compendium breaks thumbnails #108

Closed sneat closed 2 years ago

sneat commented 2 years ago

Describe the bug Exporting scenes to a compendium passes the scene data as in, including the world relative thumbnail paths. Compare this to exporting a scene to a compendium without using Compendium Folders createThumbnail is called as part of the _preCreate method. Compare the data.thumb value of a scene exported via core functionality with those exported via CF functionality.

To Reproduce Create a scene in a folder and give it a background. Export folder structure to compendium Check the raw data within the compendium and see that the thumbnail is a relative path instead of the base64 image as expected.

Suggested fix If the entity being exported is a Scene, force generate a thumbnail for it (similar to what core does). In fic-folders.js around line 1150:

if (e.documentName === 'Scene' && typeof e.createThumbnail === 'function') {
    const t = await e.createThumbnail({img: data.img});
    data.thumb = t.thumb;
}

Screenshots If applicable, add screenshots to help explain your problem.

Information

Discussion thread was on the Scene Packer discord server.

earlSt1 commented 2 years ago

Thanks, I'll check this out when ive got some time later this week

earlSt1 commented 2 years ago

Sorry for the wait, but I've got your suggested fix in the test version now. If you'd like to test it you can use this testing manifest: https://raw.githubusercontent.com/earlSt1/vtt-compendium-folders/082-update/test/module.json

I'm just waiting for some other folks to test the other changes then i'll release it.

sneat commented 2 years ago

Looks good, thanks @earlSt1 :)

earlSt1 commented 2 years ago

Fixed in v2.3.60