Take a path of a bitmap image and convert it into Base64
<p>I'm trying to take a path of an image like:
"content://media/external/images/media/3"</p>

<p>and convert it into a base64 string.  </p>

<p>Here is the code I have now:</p>

<pre><code>public String ConvertandSetImagetoBase64(String imagePath) { 
    String base64 = null;
    byte[] input = null;

    try{
        FileInputStream fd = new FileInputStream(imagePath);
        Bitmap bmt = BitmapFactory.decodeFileDescriptor(fd.getFD());

        try{                
            ByteArrayOutputStream stream = new ByteArrayOutputStream();
            Bitmap tmp = ProfileActivity.scaleDownBitmap(bmt, 10, this);
            tmp.compress(Bitmap.CompressFormat.JPEG, 10, stream);
            input = stream.toByteArray();
            base64 = Base64.encodeToString(input, Base64.DEFAULT);
            //LocalProfileActivity.input = input;
        }catch(Exception e){
            Log.e(LOG_TAG,"[ONACTIVITYRESULT] Could not bind input to the bytearray: " + e.getMessage());
        }
    }
    catch (Exception e){
        Log.e("LocalProfile", "ConvertandSetImagetoBase64: Could not load selected profile image");
    }
    return base64;
}
</code></pre>

<p>content://media/external/images/media/3 is what I'm passing into the the method.  Can anyone help me?</p>
