名前のテキストボックスとアップロードボタン(ギャラリーから画像を取得するために使用したもの)を含むサインアップページをAndroidで作成し、mysqlに保存する必要があります。
私はそれをグーグルで検索し、彼らがphpを使用しているコードをいくつか取得しましたが、私はphpを使用していません。役に立つリンクまたはコードを提供してください。Web サービスを使用してイメージを mysql に保存するにはどうすればよいですか?
名前のテキストボックスとアップロードボタン(ギャラリーから画像を取得するために使用したもの)を含むサインアップページをAndroidで作成し、mysqlに保存する必要があります。
私はそれをグーグルで検索し、彼らがphpを使用しているコードをいくつか取得しましたが、私はphpを使用していません。役に立つリンクまたはコードを提供してください。Web サービスを使用してイメージを mysql に保存するにはどうすればよいですか?
これを使って:
public void insertImg(int id , Bitmap img ) {   
    byte[] data = getBitmapAsByteArray(img); // this is a function
    insertStatement_logo.bindLong(1, id);       
    insertStatement_logo.bindBlob(2, data);
    insertStatement_logo.executeInsert();
    insertStatement_logo.clearBindings() ;
}
 public static byte[] getBitmapAsByteArray(Bitmap bitmap) {
    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
    bitmap.compress(CompressFormat.PNG, 0, outputStream);       
    return outputStream.toByteArray();
}
そして取得するには:
  public Bitmap getImage(int i){
    String qu = "select img  from table where feedid=" + i ;
    Cursor cur = db.rawQuery(qu, null);
    if (cur.moveToFirst()){
        byte[] imgByte = cur.getBlob(0);
        cur.close();
        return BitmapFactory.decodeByteArray(imgByte, 0, imgByte.length);
    }
    if (cur != null && !cur.isClosed()) {
        cur.close();
    }       
    return null ;
}