Skip to content

How can I send multiple images from oak to a browser client? #585

@M3cubo

Description

@M3cubo

I have a frontend page, let's say it contains a gallery. Every image in the gallery is a file that I have in my server (not in the public directory), so I can use .fetch(), to request them from Oak as blobs and turn them into images.

But If I have many images, how should I request these from the browser? With multiple fetch's in the client side?

On the server, I suppose I could write an oak route like this:

 Router.get(["/images/:image_ID"], async (context) => {

  let myBlob = getImageBlobFromID(context.params.image_ID)
  context.response.body = myBlob;

}); 

...and call it many times. Theoretically and practically speaking, is that how I should do it?

(and let's assume I have not created an automatic spritesheet with all the images of that gallery)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions