fix things @Almouro has mentioned, thanks @Almouro

This commit is contained in:
timzaak 2016-05-14 11:18:48 +08:00
parent 99563c8b32
commit 5f0bb88cef
2 changed files with 2 additions and 6 deletions

View File

@ -5,7 +5,6 @@ import android.content.ContentResolver;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapFactory; import android.graphics.BitmapFactory;
import android.graphics.Matrix; import android.graphics.Matrix;
import android.media.ThumbnailUtils;
import android.net.Uri; import android.net.Uri;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
@ -56,8 +55,6 @@ class ImageResizer {
return image; return image;
}catch (IOException ex) { }catch (IOException ex) {
// No memory available for resizing. // No memory available for resizing.
}catch (OutOfMemoryError ex) {
// No memory available for resizing.
} }
return null; return null;
@ -112,7 +109,7 @@ class ImageResizer {
public static String createResizedImage(Context context, String imagePath, int newWidth, public static String createResizedImage(Context context, String imagePath, int newWidth,
int newHeight, Bitmap.CompressFormat compressFormat, int newHeight, Bitmap.CompressFormat compressFormat,
int quality, int rotation) throws IOException{ int quality, int rotation) throws IOException {
Bitmap resizedImage = ImageResizer.rotateImage(ImageResizer.resizeImage(imagePath, newWidth, newHeight,context), rotation); Bitmap resizedImage = ImageResizer.rotateImage(ImageResizer.resizeImage(imagePath, newWidth, newHeight,context), rotation);
return ImageResizer.saveImage(resizedImage, context.getCacheDir(), return ImageResizer.saveImage(resizedImage, context.getCacheDir(),

View File

@ -44,7 +44,6 @@ RCT_EXPORT_METHOD(createResizedImage:(NSString *)path
[_bridge.imageLoader loadImageWithTag:path callback:^(NSError *error, UIImage *image) { [_bridge.imageLoader loadImageWithTag:path callback:^(NSError *error, UIImage *image) {
if (error || image == nil) { if (error || image == nil) {
UIImage* image;
if ([path hasPrefix:@"data:"] || [path hasPrefix:@"file:"]) { if ([path hasPrefix:@"data:"] || [path hasPrefix:@"file:"]) {
NSURL *imageUrl = [[NSURL alloc] initWithString:path]; NSURL *imageUrl = [[NSURL alloc] initWithString:path];
image = [UIImage imageWithData:[NSData dataWithContentsOfURL:imageUrl]]; image = [UIImage imageWithData:[NSData dataWithContentsOfURL:imageUrl]];