Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-16508

Android: Image doesn't show after taking photo with camera

    Details

    • Type: Story
    • Status: Closed
    • Priority: Low
    • Resolution: Won't Fix
    • Affects Version/s: Release 3.3.0
    • Component/s: Android
    • Labels:
      None
    • Environment:

      Galaxy Nexus 4.2.2

      Description

      After taking photo using camera, the image doesn't show up when bitmap is added to imageView. Log shows this error: "bitmap too large to be uploaded into a texture".

      var win1 = Titanium.UI.createWindow({
          backgroundColor : '#fff',
      });
       
      var contenner = Ti.UI.createView({
          width : Ti.UI.SIZE,
          height : Ti.UI.SIZE,
          top : 0,
          backgroundColor : '#eee',
          borderColor : '#eee',
          layout : 'vertical',
      });
      win1.add(contenner);
       
      var anImageView = Ti.UI.createImageView({
          autorotate: true,
      });
      contenner.add(anImageView);
       
      var controlview = Ti.UI.createView({
          width : Ti.UI.FILL,
          height : Ti.UI.SIZE,
          top : 20,
      });
       
      contenner.add(controlview);
       
      var frmcamera = Ti.UI.createButton({
          backgroundImage : 'none',
          backgroundColor : '#ff0000',
          title : 'Open Camera',
          color : '#fff',
          width : 80,
          height : 50,
          left : 10,
      });
       
      frmcamera.addEventListener('click', function() {
          fireUpTheCamera();
      });
       
      controlview.add(frmcamera);
       
      var overlay = Ti.UI.createView({
          width : Ti.UI.FILL,
          height : Ti.UI.FILL,
          autorotate: true,
      }); 
      // Create an ImageView.
      var overlayImg = Ti.UI.createImageView({
          image : '/KS_nav_ui.png',
          width : Ti.UI.SIZE,
          height : Ti.UI.SIZE,
      });
       
       
      overlayImg.addEventListener('click', function() {
          Ti.Media.takePicture();
      });
      overlay.add(overlayImg);
       
      function fireUpTheCamera() {
          Titanium.Media.showCamera({
       
              success : function(event) {
                  var cropRect = event.cropRect;
                  var image = event.media;
       
                  Ti.API.debug('Our type was: ' + event.mediaType);
                  if (event.mediaType == Ti.Media.MEDIA_TYPE_PHOTO) {
                      anImageView.image = image;
                      //new_upload_profile_picture_update(anImageView.image);
                  } else {
                      alert("got the wrong type back =" + event.mediaType);
                  }
              },
              cancel : function() {
              },
              error : function(error) {
                  // create alert
                  var a = Titanium.UI.createAlertDialog({
                      title : 'Camera'
                  });
       
                  // set message
                  if (error.code == Titanium.Media.NO_CAMERA) {
                      a.setMessage('Please run this test on device');
                  } else {
                      a.setMessage('Unexpected error: ' + error.code);
                  }
       
                  // show alert
                  a.show();
              },
              saveToPhotoGallery : true,
              allowEditing : false,
              overlay : overlay,
              mediaTypes : [Ti.Media.MEDIA_TYPE_PHOTO]
          });
      }
       
      win1.open();
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                hpham Hieu Pham
                Reporter:
                hpham Hieu Pham
                Reviewer:
                Vishal Duggal (Inactive)
              • Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    TIMOB-18401
                    Sync status:
                    ERROR
                    Last received:
                    Last sent:

                    Git Integration