mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2026-01-20 11:09:45 +00:00
Add basic support for base64 URLs.
This commit is contained in:
@@ -142,7 +142,12 @@
|
||||
- (void)_setImageForAsset:(LOTAsset *)asset {
|
||||
if (asset.imageName) {
|
||||
UIImage *image;
|
||||
if (asset.rootDirectory.length > 0) {
|
||||
if ([asset.imageName hasPrefix:@"data:"]) {
|
||||
// Contents look like a data: URL. Ignore asset.imageDirectory and simply load the image directly.
|
||||
NSURL *imageUrl = [NSURL URLWithString:asset.imageName];
|
||||
NSData *imageData = [NSData dataWithContentsOfURL:imageUrl];
|
||||
image = [UIImage imageWithData:imageData];
|
||||
} else if (asset.rootDirectory.length > 0) {
|
||||
NSString *rootDirectory = asset.rootDirectory;
|
||||
if (asset.imageDirectory.length > 0) {
|
||||
rootDirectory = [rootDirectory stringByAppendingPathComponent:asset.imageDirectory];
|
||||
|
||||
Reference in New Issue
Block a user