Platforms to show: All Mac Windows Linux Cross-Platform
PHImageManagerMBS class
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
class | Photos | MBS Mac64bit Plugin | 20.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
Use these methods to fetch full-size photo assets or thumbnail images, or to retrieve AVFoundation objects for playing, exporting, and manipulating video assets.
To load image or video data:
1. Use the PHAsset class to fetch the asset you’re interested in.
2. Call the defaultManager method to retrieve the shared image manager object.
3. Use one of the methods listed in Requesting Images and Requesting Video Objects to load the asset’s image or video data.
The image manager caches the asset images and data it provides, so later requests for the same assets with similar parameters will return results more quickly.
If you need to load image data for many assets together, use the PHCachingImageManagerMBS class to “preheat” the cache by loading images you expect to need soon. For example, when populating a collection view with photo asset thumbnails, you can cache images ahead of the current scroll position.
Available in MacOS 10.13 or later.
- property Handle as Integer
- 9 methods
- method cancelImageRequest(requestID as Integer)
- method Constructor
- method RequestAVAssetForVideo(asset as PHAssetMBS, options as PHVideoRequestOptionsMBS, exportPreset as String, CompletionHandler as RequestAVAssetForVideoCompletedMBS, tag as Variant = nil) as Integer
- method RequestExportSessionForVideo(asset as PHAssetMBS, options as PHVideoRequestOptionsMBS, exportPreset as String, CompletionHandler as RequestExportSessionForVideoCompletedMBS, tag as Variant = nil) as Integer
- method RequestImageDataAndOrientationForAsset(asset as PHAssetMBS, options as PHImageRequestOptionsMBS, CompletionHandler as RequestImageForAssetCompletedMBS, tag as Variant = nil) as Integer
- method RequestImageForAsset(asset as PHAssetMBS, targetSize as CGSizeMBS, contentMode as Integer, options as PHImageRequestOptionsMBS, CompletionHandler as RequestImageForAssetCompletedMBS, tag as Variant = nil) as Integer
- method RequestImageForAssetSync(asset as PHAssetMBS, targetSize as CGSizeMBS, contentMode as Integer, options as PHImageRequestOptionsMBS, byref Info as Dictionary) as NSImageMBS
- method RequestLivePhotoForAsset(asset as PHAssetMBS, targetSize as CGSizeMBS, contentMode as Integer, options as PHLivePhotoRequestOptionsMBS, CompletionHandler as RequestLivePhotoForAssetCompletedMBS, tag as Variant = nil) as Integer
- method RequestPlayerItemForVideo(asset as PHAssetMBS, options as PHVideoRequestOptionsMBS, CompletionHandler as RequestPlayerItemForVideoCompletedMBS, tag as Variant = nil) as Integer
- 8 shared methods
- shared method available as boolean
- shared method defaultManager as PHImageManagerMBS
- shared method MaximumSize as CGSizeMBS
- shared method PHImageCancelledKey as String
- shared method PHImageErrorKey as String
- shared method PHImageResultIsDegradedKey as String
- shared method PHImageResultIsInCloudKey as String
- shared method PHImageResultRequestIDKey as String
- 6 delegates
- delegate RequestAVAssetForVideoCompletedMBS(asset as PHAssetMBS, options as PHVideoRequestOptionsMBS, AVAsset as Variant, AVAudioMix as Variant, info as Dictionary, tag as Variant)
- delegate RequestExportSessionForVideoCompletedMBS(asset as PHAssetMBS, options as PHVideoRequestOptionsMBS, exportPreset as string, exportSession as Variant, info as Dictionary, tag as Variant)
- delegate RequestImageDataAndOrientationForAssetCompletedMBS(asset as PHAssetMBS, options as PHImageRequestOptionsMBS, imageData as MemoryBlock, dataUTI as String, orientation as Integer, info as Dictionary, tag as Variant)
- delegate RequestImageForAssetCompletedMBS(asset as PHAssetMBS, options as PHImageRequestOptionsMBS, result as NSImageMBS, info as Dictionary, tag as Variant)
- delegate RequestLivePhotoForAssetCompletedMBS(asset as PHAssetMBS, options as PHImageRequestOptionsMBS, livePhoto as PHLivePhotoMBS, info as Dictionary, tag as Variant)
- delegate RequestPlayerItemForVideoCompletedMBS(asset as PHAssetMBS, options as PHVideoRequestOptionsMBS, playerItem as Variant, info as Dictionary, tag as Variant)
- 4 constants
Constants
Constant | Value | Description |
---|---|---|
PHInvalidImageRequestID | 0 | A special value provided for asynchronous image requests that cannot be canceled. |
Content Modes
Constant | Value | Description |
---|---|---|
ContentModeAspectFill | 1 |
Scales the image so that it completely fills the target size. |
ContentModeAspectFit | 0 |
Scales the image so that its larger dimension fits the target size. |
ContentModeDefault | 0 | Fits the image to the requested size using the default option, PHImageContentModeAspectFit. more |
Sub classes:
Some examples using this class:
Blog Entries
The items on this page are in the following plugins: MBS Mac64bit Plugin.
PhidgetVoltageRatioInputMBS - PHImageRequestOptionsMBS