private void uploadImage(Bitmap bmp) {

    new Thread(() -> {
        try {

            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            bmp.compress(Bitmap.CompressFormat.JPEG, 90, baos);
            byte[] imageBytes = baos.toByteArray();

            String imageBase64 = Base64.encodeToString(imageBytes, Base64.DEFAULT);

            String urlStr = ApiConfig.endpoint(this, "upload_po_photo.php");

            URL url = new URL(urlStr);
            HttpURLConnection conn = (HttpURLConnection) url.openConnection();

            conn.setRequestMethod("POST");
            conn.setRequestProperty("Content-Type", "application/json");
            conn.setDoOutput(true);

            JSONObject json = new JSONObject();
            json.put("id_po", idPo);
            json.put("image", imageBase64);

            OutputStream os = conn.getOutputStream();
            os.write(json.toString().getBytes("utf-8"));
            os.close();

            int code = conn.getResponseCode();

            runOnUiThread(() -> {
                Toast.makeText(this, "Upload selesai", Toast.LENGTH_SHORT).show();
                finish();
            });

        } catch (Exception e) {
            e.printStackTrace();
        }
    }).start();
}