voicecode-bv/mobile-photos
最新稳定版本:1.0.0
Composer 安装命令:
composer require voicecode-bv/mobile-photos
包简介
Save remote images and videos directly to the device photo library for NativePHP Mobile.
README 文档
README
Save remote images and videos directly to the device photo library (camera roll on iOS, MediaStore gallery on Android) from a NativePHP Mobile app — no share sheet, no extra taps.
Installation
composer require voicecode-bv/mobile-photos
After install, register the plugin so it gets compiled into the native projects:
php artisan native:plugin:register voicecode-bv/mobile-photos
Then rebuild the iOS and Android projects through the usual NativePHP build flow.
iOS notes
The plugin manifest declares NSPhotoLibraryAddUsageDescription. You can override the prompt copy by setting your own value in nativephp/ios/NativePHP/Info.plist — the plugin compiler will not overwrite a key that already exists.
The plugin uses iOS' add-only authorization (PHAccessLevel.addOnly), which means users don't have to give full photo library access just to save a single file.
Android notes
Requires Android 10 (API 29) or higher. Saves go through MediaStore so no runtime storage permission is needed.
Usage
From PHP
use Voicecode\Mobile\Photos\Photos; app(Photos::class)->save('https://cdn.example.com/photo.jpg'); app(Photos::class)->save('https://cdn.example.com/clip.mp4', 'video');
From JavaScript / TypeScript
import { BridgeCall } from '@nativephp/mobile'; const result = await BridgeCall('Photos.Save', { url: 'https://cdn.example.com/photo.jpg', // type is optional — inferred from the URL extension when omitted. type: 'image', }); if (result?.status === 'saved') { // saved to camera roll / gallery }
The call returns synchronously once the asset has been written. On failure the response carries a code and message (PERMISSION_DENIED, EXECUTION_FAILED, INVALID_PARAMETERS).
License
MIT
统计信息
- 总下载量: 1
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 13
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-05-14