How to create onclick of DrawableImage and set an image from the camera?

I want to capture user profile picture for Mobile app. I have round shape icon to display user for profile pic. When user click on that, open device camera and capture image to set in user profile screen in Round shape. Can you please help me how can i do that? or share any code if you have done in past. i am beginner in juce
i have attached sample image.(1.png) I want to set an image for first time and when user set an image from camera it should look like this in( 2.png)


2

One method would be to subclass the DrawableImage class and override mouseDown() to capture the mouse click. Or, use the DrawableButton class, where you can use the onClick method.

i am unable to call the click using mouseDown method here is my code.

imgcameraicon.setImage(ImageCache::getFromMemory(BinaryData::camera64_png,
BinaryData::camera64_pngSize));
addAndMakeVisible(imgcameraicon);
imgcameraicon.setBounds(147, 137, 80, 80);
imgcameraicon.addMouseListener (this, false);

//Method

void mouseDown (const MouseEvent& ey) override {
if (ey.eventComponent == &imgcameraicon) {
AlertWindow::showMessageBoxAsync(AlertWindow::NoIcon,“Title”,“Message”);
}
}

Instead of adding a MouseListener, you need a Button::Listener to receive the button click:

imgcameraicon.addListener (this);

// Method
void buttonClicked (Button *b) override
{
    if (b == &imgcameraicon)
    {
        // ...
    }
}

N.B. please surround your code with three backticks on a single line each, so the code is properly formatted:

    ```
    int main()
    {
        return 0;
    }
    ```

sure sir. Thank you can you please give me reply if you know how to do this? in given link How to draw Rounded corner rectangle as per given image sample?

Sir imgcameraicon is my DrawableImage. So i can not get this line. imgcameraicon.addListener (this); can you please share other idea?