Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion package/ios/ImageManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ + (UIImage *)getImageFromDictionarySource:(NSDictionary *)imageObj
if([urlString hasPrefix: @"http"] || [urlString hasPrefix: @"https"]) {
NSURL *url = [NSURL URLWithString: urlString];
NSData *data = [NSData dataWithContentsOfURL:url];
imageData = [[UIImage alloc] initWithData:data];
if (data && data.length > 0) {
imageData = [[UIImage alloc] initWithData:data];
} else {
imageData = nil;
}
} else {
imageData = [RCTConvert UIImage:imageObj];
}
Expand Down
5 changes: 5 additions & 0 deletions package/ios/ThePrinter.m
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,11 @@ -(int) addImage: (NSDictionary *)source
return EPOS2_ERR_MEMORY;
}
UIImage *data = [ImageManager getImageFromDictionarySource:source];
// Check if image loading failed (e.g., due to network issues)
if (data == nil) {
return EPOS2_ERR_FAILURE;
}

CGSize size = [ImageManager getImageCGSize:data width:width];
UIImage *scaledImage = [ImageManager scaleImage:data size:size];

Expand Down
Loading