Note that there are some explanatory texts on larger screens.

plurals
  1. POCompress camera image before upload
    primarykey
    data
    text
    <p>I am using this code (from <a href="http://www.internetria.com/blog/2013/04/12/android-enviar-imagenes-por-webservice/" rel="noreferrer" title="www.internetria.com">www.internetria.com</a>) to take a photo and upload to a server:</p> <p>onCreate:</p> <pre><code>Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); Uri output = Uri.fromFile(new File(foto)); intent.putExtra(MediaStore.EXTRA_OUTPUT, output); startActivityForResult(intent, TAKE_PICTURE); </code></pre> <p>onActivityResult:</p> <pre><code>ImageView iv = (ImageView) findViewById(R.id.imageView1); iv.setImageBitmap(BitmapFactory.decodeFile(foto)); File file = new File(foto); if (file.exists()) { UploaderFoto nuevaTarea = new UploaderFoto(); nuevaTarea.execute(foto); } else Toast.makeText(getApplicationContext(), "No se ha realizado la foto", Toast.LENGTH_SHORT).show(); </code></pre> <p>UploaderFoto:</p> <pre><code>ProgressDialog pDialog; String miFoto = ""; @Override protected Void doInBackground(String... params) { miFoto = params[0]; try { HttpClient httpclient = new DefaultHttpClient(); httpclient.getParams().setParameter(CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_1); HttpPost httppost = new HttpPost("http://servidor.com/up.php"); File file = new File(miFoto); MultipartEntity mpEntity = new MultipartEntity(); ContentBody foto = new FileBody(file, "image/jpeg"); mpEntity.addPart("fotoUp", foto); httppost.setEntity(mpEntity); httpclient.execute(httppost); httpclient.getConnectionManager().shutdown(); } catch (Exception e) { e.printStackTrace(); } return null; } </code></pre> <p>And I want to compress the image, because the size is too big.</p> <p>I don't know how to add <code>bitmap.compress(Bitmap.CompressFormat.JPEG, 70, fos);</code> to my app</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload