Usage
Capture a photo:Methods
getPhoto(array $options = [])
Opens the native camera app for photo capture.
Parameters:
$options(array) - Optional capture configuration
PendingPhotoCapture - Fluent interface for configuring the capture
Events:
Camera\PhotoTaken- Dispatched when photo is capturedCamera\PhotoCancelled- Dispatched when user cancels
pickImages(string $media_type = 'all', bool $multiple = false, int $max_items = 10)
Opens the native gallery picker for selecting photos and/or videos.
Parameters:
$media_type(string) - Type of media:'image','video', or'all'(default:'all')$multiple(bool) - Allow multiple selection (default:false)$max_items(int) - Maximum items when multiple=true (default:10)
PendingMediaPicker - Fluent interface for configuring the picker
Events:
Gallery\MediaSelected- Dispatched when media is selected
recordVideo(array $options = [])
Opens the native camera app for video recording.
Parameters:
$options(array) - Optional recording configurationmaxDuration(int) - Maximum recording duration in seconds
PendingVideoRecorder - Fluent interface for configuring the recorder
Events:
Camera\VideoRecorded- Dispatched when video is recordedCamera\VideoCancelled- Dispatched when user cancels
Photo Capture API
ThePendingPhotoCapture class provides a fluent interface:
id(string $id)
Set a unique identifier for the capture request.
Example:
event(string $eventClass)
Dispatch a custom event instead of the default PhotoTaken event.
Example:
remember()
Store the capture ID in the session for later retrieval.
Example:
start()
Explicitly start the photo capture (called automatically if not invoked).
Example:
Media Picker API
ThePendingMediaPicker class provides a fluent interface:
mediaType(string $type)
Set the type of media to select: 'image', 'video', or 'all'.
Example:
images()
Only allow image selection.
Example:
videos()
Only allow video selection.
Example:
all()
Allow both images and videos (default).
Example:
multiple(bool $multiple = true, int $maxItems = 10)
Allow multiple media selection.
Example:
single()
Only allow single media selection (default).
Example:
Video Recorder API
ThePendingVideoRecorder class provides a fluent interface:
maxDuration(int $seconds)
Set the maximum recording duration in seconds.
Example:
id(string $id)
Set a unique identifier for the recording request.
Example:
Events
Native\Mobile\Events\Camera\PhotoTaken
Properties:
path(string) - File path to the captured photomimeType(string) - MIME type (e.g., ‘image/jpeg’)id(string|null) - The unique identifier if one was set
Native\Mobile\Events\Gallery\MediaSelected
Dispatched when media is selected from the gallery. Contains information about selected files.
Native\Mobile\Events\Camera\VideoRecorded
Properties:
path(string) - File path to the recorded videomimeType(string) - MIME type (e.g., ‘video/mp4’)id(string|null) - The unique identifier if one was set
Examples
Profile Photo Upload
Multiple Image Gallery Selection
Video Story Recording
Photo or Video Selection
Custom Event Handler
Platform Notes
iOS
- Uses
UIImagePickerControllerfor camera and gallery access - Requires
NSCameraUsageDescriptionin Info.plist for camera access - Requires
NSPhotoLibraryUsageDescriptionfor gallery access - Photos are saved to app’s temporary directory
- Quality and camera selection controlled by native camera app
Android
- Uses
ACTION_IMAGE_CAPTUREandACTION_VIDEO_CAPTUREintents - Requires
CAMERApermission in AndroidManifest.xml - Requires
READ_EXTERNAL_STORAGEpermission for gallery access - Photos stored in app’s cache directory
- Native camera app handles all recording settings
All captured media is stored in temporary directories. Make sure to move or upload files to permanent storage in your event handlers before they are automatically cleaned up.