Skip to content

Serving large numbers of images #263

Answered by FabienArcellier
TPreece101 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @TPreece101,

Thanks for your feedback.

A way to expose image to streamsync is to read them as dataurl. To limit the number of image to read, you can use the Pagination component. (not documented, it will be fix next release)

import base64

binary_fc = open(filepath, 'rb').read() 
base64_utf8_str = base64.b64encode(binary_fc).decode('utf-8')
ext     = filepath.split('.')[-1]
dataurl = f'data:image/{ext};base64,{base64_utf8_str}'

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@TPreece101
Comment options

Answer selected by TPreece101
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #262 on February 26, 2024 06:56.