Skip to content

Getting photos via mobile upload #2715

Answered by snowbollaanm
snowbollaanm asked this question in Q&A
Discussion options

You must be logged in to vote

Hopefully final addition to this!
I've created a class that can be called to add this "camera" to the page. Note that it will only open a camera on a mobile device otherwise on a computer it will open a file explorer. Thanks!

Class:

from typing import Callable, Optional, Any
import asyncio

from nicegui import ui


class Camera():
    def __init__(
        self,
        icon: str,
        icon_color: str,
        background_color: str,
        for_id: Optional[str] = 'file-upload',
        canvas_id: Optional[str] = 'canvas',
        on_change: Optional[Callable[..., Any]] = None,
        compression: Optional[float] = 0.8,
    ):
        """Camera Input
                :param icon: The i…

Replies: 3 comments 18 replies

Comment options

You must be logged in to vote
7 replies
@snowbollaanm
Comment options

@rodja
Comment options

@snowbollaanm
Comment options

@snowbollaanm
Comment options

@rodja
Comment options

Comment options

You must be logged in to vote
2 replies
@falkoschindler
Comment options

@snowbollaanm
Comment options

Comment options

You must be logged in to vote
9 replies
@snowbollaanm
Comment options

@mattloose
Comment options

@mattloose
Comment options

@mattloose
Comment options

@mattloose
Comment options

Answer selected by snowbollaanm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
help wanted Extra attention is needed
4 participants