Document thumbnail previews

This commit is contained in:
Isaac Lyons 2021-04-28 17:03:31 -06:00 committed by GitHub
parent a42084f924
commit f68cc90187
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 0 deletions

View File

@ -182,6 +182,20 @@ Image functions include:
_Why is there no `deleteCachedImage` or `cachedImageURL` function when there is `getCachedThumbnail` and `cachedThumbnailURL`?_
Images are stored in the disk cache the same way as data. The image-specific functions exist as a convenience for converting the data to UIImages and caching them in memory that way. Since the cached data URL does not change whether the data is an image or not, `deleteCachedData` and `cachedDataURL` can be used for images.
#### Thumbnail preview
If there are already cached thumbnails for the image you are trying to fetch, you can use the `preview` parameter to specify that you would like to get that thumbnail first while the full-size image is downloading.
```swift
webDAV.downloadImage(path: imagePath, account: account, password: password, preview: .memoryOnly) { image, error in
// Display the image.
// This will run once on the largest cached thumbnail (if there are any)
// and again with the full-size image.
}
```
See [Thumbnails](#thumbnails) for more details on thumbnails.
### Thumbnails
Along with downloading full-sized images, you can download **thumbnails** from Nextcloud servers.