Uploading Image from Android to PHP server throws Exception in case of Avg size images also,works fine with very small ones only
<p>I m using following code </p>

<pre><code>.try {
       String strurl = GlobalConfig.url
         + "uploadBlogData.php";
         try{

b = Media.getBitmap(getContentResolver(), ImageURI); // b is of type Bitmap 
    //This line is throwing exception

      Log.d("height",""+b.getHeight());
     Log.d("width",""+b.getWidth());

        int width = b.getWidth();
         int height = b.getHeight();

          int newHeight=b.getHeight()/2;
       int newWidth=b.getWidth()/2;
   float scaleWidth = ((float) newWidth) / width;


      float scaleHeight = ((float) newHeight) / height;



             // CREATE A MATRIX FOR THE MANIPULATION



            Matrix matrix = new Matrix();



           // RESIZE THE BIT MAP


           matrix.postScale(scaleWidth, scaleHeight);



      // RECREATE THE NEW BITMAP



  Bitmap resizedBitmap = Bitmap.createBitmap(b, 0, 0, width, height, matrix, false);.
</code></pre>

<p>and i m receiving following exception in case of any image greate than 1MB .
java.lang.OutOfMemoryError: bitmap size exceeds VM budget</p>

<p>Can you suggest me what to do?</p>
