OneZoom / OZtree

OneZoom Tree of Life Explorer
Other
88 stars 20 forks source link

Solution for storing bespoke tour media #741

Closed jrosindell closed 7 months ago

jrosindell commented 7 months ago

I've opened this issue so that we can have a discussion about where to store bespoke media for tours. E.g. suppose we have some audio or images not in the tree but which are part of tours (note we agreed video would be hosted on Vimeo). I know we've discussed this before but I'd like to see an example actually working.

I know this will come up because people I've asked about building tours have already mentioned it.

I'd suggest that a place for tour media separate from the tree images media be created in static and that a script be written that moves media into the appropriate place in static (perhaps a folder for each tour) whilst the curl command be updated to handle media stings that reference bespoke files. We'll assume that license information for each image is in the metadata for that image.

jrosindell commented 7 months ago

I've pushed a popularity tour - it's rubbish but it illustrates a couple of issues. One is that we can't use images from other sources as the splash image for a tour. I don't so much mind this but I do think it's essential that we have the ability to store custom splash images to represent a tour in static.

lentinj commented 7 months ago

I've opened this issue so that we can have a discussion about where to store bespoke media for tours

I think bunging them into the tours repository is an obvious choice. The quick option is to then link directly to the repository, e.g. https://raw.githubusercontent.com/OneZoom/OZtree/main/static/images/maintenance.jpg

We could host the tour repository ourselves as static files, but makes tour deployment even more awkward, and as #601 points out we potentially want to do image caching for Wikimedia too anyway.

lentinj commented 7 months ago

Thinking about this further, we don't really care about the metadata, we just want a page to link to. Storing in the database is entirely unnecessary. So how about:

The only downside here is we don't have the ability to choose different image sizes (as with #736), but I'm not convinced that's a problem.

This could obviously be used for wikimedia images as well instead of #736. You'd have to copy the image and file the metadata which is more work, but you don't run the risk of the image disappearing or bait-and-switch-ing.

lentinj commented 7 months ago

I'm fairly sure this is what we want to do, so I've gone ahead and done it.

Note that the .html output is generated any time you push to the tours repository.

The frogs tour now links to this image. When we display the tourstop, we:

If you're happy, this could be a reasonable solution to both this and #736. We can work on the template for the copyright pages so it's a bit less offensive, and have a custom "tours.onezoom.org" domain if we want.

Self-hosting would also be possible if we want to jump through those hoops too.

EDIT: Another thing we might want to do is make media URLs in tour JSON relative to here, both saving typing and meaning there's far fewer places to change the domain if we wanted to.

jrosindell commented 7 months ago

I'm very happy with this solution. Your suggestion of making URLs in the JSON relative to here makes sense to me as well. I would assume that we can use the same system for an audio file and that the existing method of using an image from the tree remains unchanged.

lentinj commented 7 months ago

I would assume that we can use the same system for an audio file

Yes, I've put in a template for images, audio & video (but it's really not a great solution for video):

https://github.com/OneZoom/OZtree/blob/b95031eee4e1a0cabe12deb4b553b659ebfa585d/modules/embed.py#L108-L133

the existing method of using an image from the tree remains unchanged

Hrm, that's a point. We support "imgsrc:99:26853372" in the "image_url" section for thumbnail images, but there isn't a proviso for such urls in the media section. In theory we already have a copyright page to link to, so supporting these would be do-able.

jrosindell commented 7 months ago

I think it would be nice to be able to use imgsrc:99:26853372 or a URL in both the overall splash image for a tour or in the media section for a tour.

lentinj commented 7 months ago

The remaining task here is to tidy the generated HTML to have correct titles, and look more presentable.

We should also document the process of adding an image in the tours README.

lentinj commented 7 months ago

Done in the tours repo:

https://github.com/OneZoom/tours/commit/356cfcce239e80840de4eed79ba8be4010376588

https://github.com/OneZoom/tours/commit/a0f95acb6589be129aeca9116d11c4c9eb55d11b

https://github.com/OneZoom/tours/blob/main/README.md#adding-bespoke-images--audio-to-tours