@@ -0,0 +1,3216 @@
+package org.apache.cordova.plugin;%0A%0Aimport android.util.Log;%0Aimport org.apache.cordova.api.CallbackContext;%0Aimport org.apache.cordova.api.CordovaPlugin;%0Aimport org.json.JSONArray;%0Aimport org.json.JSONException;%0A%0Aimport android.media.ThumbnailUtils;%0Aimport android.graphics.Bitmap;%0Aimport android.graphics.BitmapFactory;%0Aimport android.provider.MediaStore.Video.Thumbnails;%0Aimport java.io.FileOutputStream;%0A%0A/**%0A * This class echoes a string called from JavaScript.%0A */%0Apublic class Thumbnailer extends CordovaPlugin %7B%0A%0A    private static final String LOG_TAG = %22Thumbnailer%22;%0A%0A    private void writeThumbnail(Bitmap srcBitmap, String srcPath, String dstPath, CallbackContext callbackContext) %7B%0A        if (srcPath != null && srcPath.length() %3E 0) %7B%0A            try %7B%0A                FileOutputStream out = new FileOutputStream(dstPath);%0A                srcBitmap.compress(Bitmap.CompressFormat.JPEG, 55, out);%0A                callbackContext.success(dstPath);%0A            %7D catch (Exception e) %7B%0A                e.printStackTrace();%0A                callbackContext.error(%22Cannot create thumbnail file to path = %22 + dstPath);%0A            %7D%0A        %7D else %7B%0A            callbackContext.error(%22Invalid destination file path = %22 + srcPath);%0A        %7D%0A    %7D%0A%0A    private void writeThumbnail(Bitmap srcBitmap, String srcPath, CallbackContext callbackContext) %7B%0A        String dstPath;%0A%0A        if (!srcPath.matches(%22.*%5C%5C.jpg$%22)) %7B%0A            dstPath = srcPath + %22.jpg%22;%0A        %7D else %7B%0A            dstPath = srcPath;%0A        %7D%0A%0A        Log.d(LOG_TAG, %22From : %22 + dstPath);%0A        dstPath = dstPath.replaceAll(%22%5C%5C.jpg$%22, %22.thumb.jpg%22);%0A        Log.d(LOG_TAG, %22To : %22 + dstPath);%0A%0A        writeThumbnail(srcBitmap, srcPath, dstPath, callbackContext);%0A    %7D%0A%0A    /**%0A     * Executes the request and returns PluginResult.%0A     *%0A     * @param action        The action to execute.%0A     * @param args          Arguments for the plugin.%0A     * @param callbackContext    The callback id used when calling back into JavaScript.%0A     * @return              A PluginResult object with a status and message.%0A     */%0A    @Override%0A    public boolean execute(String action, JSONArray args, CallbackContext callbackContext) %7B%0A        try %7B%0A            if (action.equals(%22createVideoThumbnail%22)) %7B%0A                String srcPath = args.getString(0);%0A%0A                // MINI_KIND: 512 x 384 thumbnail%0A                Bitmap bmThumbnail = ThumbnailUtils.createVideoThumbnail(srcPath, Thumbnails.MINI_KIND);%0A                writeThumbnail(bmThumbnail, srcPath, callbackContext);%0A                return true;%0A            %7D else if (action.equals(%22createImageThumbnail%22)) %7B%0A                String srcPath = args.getString(0);%0A                Bitmap bitmap = BitmapFactory.decodeFile(srcPath);%0A                Bitmap bmThumbnail = ThumbnailUtils.extractThumbnail(bitmap, 160, 120);%0A                writeThumbnail(bmThumbnail, srcPath, callbackContext);%0A                return true;%0A            %7D else %7B%0A                callbackContext.error(%22Invalid method%22);%0A                return false;%0A            %7D%0A        %7D catch (JSONException e) %7B%0A            callbackContext.error(%22Invalid JSON variable%22);%0A        %7D%0A        return false;%0A    %7D%0A%7D%0A

Create Thumbnailer.java