Working with Widgets > 3D > Camera
  
Camera
What Does This Widget Do?
Allows you to take a picture in a 3D eyewear experience.
When Should I Use This Widget?
Use the Camera widget when you want to enable users to take a picture during an experience.
* 
If you want to save pictures to a repository in your ThingWorx instance, the following configuration parameter must be manually added to the configuration.json file by an administrator:
"nohttp2":true
If your Experience Service is installed on-premises, contact your administrator.
If your Experience Service is hosted by PTC, open a support case, select Vuforia Studio from the Product field, and then select Yes – Request an activity (refresh,build,access,upgrade etc) or information on PTC Cloud Environment from the Do you want to open a case with PTC Cloud Services? drop-down menu.
Are There Any Special Properties, Services, Events, or Actions?
To view a list of common widget properties, services, and events, see Common Widget Properties, Services, and Events.
The following table is a list of properties that are specific to this widget.
Property
JavaScript
Type
Description
Hide 3D Augmentations
isAugmentationsHidden
boolean
When selected, 3D augmentations in the experience are hidden.
Image Data
image
string
A base64-encoded string (text) of the resulting JPEG image taken by the camera.
Image URL
ImageUrl
string
Wraps the image data above into a hyperlink which can be embedded in a web page, or bound as the Resource of a 3D Image widget.
Confirmation UI
JavaScript
Type
Description
Accept Button Label
acceptLabel
string
Text that appears on button to accept the photo taken.
Retake Button Label
retakeLabel
string
Text that appears on button to retake the photo.
Cancel Button Label
cancelLabel
string
Text that appears on button to cancel taking a photo.
Service
JavaScript
Description
Take Picture
takePicture
Invoking this service creates a screenshot.
Event
JavaScript
Description
Picture Taken
pictureTaken
Triggered when the picture is taken. Arguments contain width, height, and orientation (landscape or portrait).
User Canceled
userCanceled
Triggered when a user cancels the camera.
The Widget in Action
Here’s an example of what your widget might look like.
Minimum Steps Required for Use
1. From the 3D canvas of a 3D eyewear project, drag and drop a Camera widget onto the canvas.
2. Drag and drop a 3D Button widget onto the canvas.
3. Enter the text you want displayed on the button. For example, Take Picture.
4. Drag and drop the icon next to Click event of the Button onto camera-1 in the project tree.
5. Select Take Picture on the Select Binding Target window and click Bind.
6. Drag and drop a 3D Image widget onto the canvas
7. Drag and drop the Image URL property of the Camera widget onto the 3D Image widget. Select Resource on the Select Binding Target window and click Bind.
Once you’ve completed steps 1-5, you can optionally implement the following steps.
1. Bind the Image URL property of the Camera widget to a 3D Image widget. Select Resource as the binding target.
2. Bind the Image Data property of the Camera widget into the ThingWorx services to store the images.