Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing #7

Closed
wants to merge 7 commits into from
Closed
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
1 change: 1 addition & 0 deletions plugin.xml
Original file line number Diff line number Diff line change
@@ -12,6 +12,7 @@
<dependency id="cordova-plugin-file"/>

<platform name="android">

<config-file target="res/xml/config.xml" parent="/*">
<feature name="Thumbnails">
<param name="android-package" value="com.cordova.plugin.thumbnail.ThumbnailsCordovaPlugin"/>
8 changes: 6 additions & 2 deletions src/android/Thumbnails.java
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@

public class Thumbnails {

public static void thumbnail(Options thumbnailOptions) throws IOException {
public static void thumbnail(Options thumbnailOptions) throws Exception {
long begin = System.currentTimeMillis();

Bitmap bitmap = thumbnailSmallImage(thumbnailOptions);
@@ -37,12 +37,16 @@ public static void thumbnail(Options thumbnailOptions) throws IOException {
bitmap = null;
}

private static Bitmap thumbnailSmallImage(Options thumbnailOptions) throws IOException {
private static Bitmap thumbnailSmallImage(Options thumbnailOptions) throws Exception {

BitmapFactory.Options options = calculateImageSize(thumbnailOptions.sourcePath);
options.inJustDecodeBounds = false;
Bitmap bitmap = BitmapFactory.decodeFile(thumbnailOptions.sourcePath, options);

if (bitmap == null) {
throw new Exception("Could not decode file into bitmap object { sourcePath: " + thumbnailOptions.sourcePath + " options: }");
}

long begin = System.currentTimeMillis();
int oWidth = bitmap.getWidth();
int oHeight = bitmap.getHeight();