Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-17

WebView caching resized pictures

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.1.0
    • 1.3.0
    • cordova-android
    • None

    Description

      If you request a picture from the photo library and you provide a targetHeight/targetWidth we create a temp file in the application cache directory called resize.jpg. If you then show this file in your PG application it works fine. Any subsequent calls to getPhoto using targetHeight/targetWidth will create a new resize.jpg but when you go to display it in your app it shows the first one as it is cached.

      Workaround: If your picture is small enough use DATA_URL

      Here is some code to reproduce:

      function getPhoto(source) {
      sourceType=source;
      window.resolveLocalFileSystemURI("file:///mnt/sdcard/Android/data/
      com.phonegap.helloworld/cache/resize.jpg", fileExist, onFail);
      }
      //,allowEdit: true,targetWidth:390,targetHeight:390

      function fileExist(fileEntry) {
      alert(fileEntry.fullPath);
      fileEntry.remove(removeSuccess,removeFail);
      }

      function onFail(error) {
      navigator.camera.getPicture(onPhotoURISuccess, onFail,

      { quality: 75, destinationType: destinationType.FILE_URI, sourceType: sourceType,targetWidth:390,targetHeight:390}

      );
      }

      function removeSuccess() {
      alert("file Success Removed");
      navigator.camera.getPicture(onPhotoURISuccess, onFail,

      { quality: 75, destinationType: destinationType.FILE_URI, sourceType: sourceType,targetWidth:390,targetHeight:390}

      );
      }
      function removeFail(error) {
      status("Image file delete failed (error " + error.code + ")");
      }

      Attachments

        Activity

          People

            macdonst Simon MacDonald
            macdonst Simon MacDonald
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: