You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by "Simon MacDonald (Created) (JIRA)" <ji...@apache.org> on 2011/11/17 22:05:50 UTC
[jira] [Created] (CB-17) WebView caching resized pictures
WebView caching resized pictures
--------------------------------
Key: CB-17
URL: https://issues.apache.org/jira/browse/CB-17
Project: Apache Callback
Issue Type: Bug
Components: Android
Affects Versions: 1.1.0
Reporter: Simon MacDonald
Assignee: Simon MacDonald
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 + ")");
}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (CB-17) WebView caching resized pictures
Posted by "r stewart (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CB-17?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13163268#comment-13163268 ]
r stewart commented on CB-17:
-----------------------------
So how do you get the original filename?
window.resolveLocalFileSystemURI(imageURL, getFileName, onFail); imageURL returns "resize.jpg"
Should also return original image width, height and maybe the size.
1. original name
2. orginal dimensions
> WebView caching resized pictures
> --------------------------------
>
> Key: CB-17
> URL: https://issues.apache.org/jira/browse/CB-17
> Project: Apache Callback
> Issue Type: Bug
> Components: Android
> Affects Versions: 1.1.0
> Reporter: Simon MacDonald
> Assignee: Simon MacDonald
> Fix For: 2.0.0
>
>
> 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 + ")");
> }
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Resolved] (CB-17) WebView caching resized pictures
Posted by "Simon MacDonald (Resolved) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CB-17?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Simon MacDonald resolved CB-17.
-------------------------------
Resolution: Fixed
Fix Version/s: 2.0.0
I fixed this by adding a timestamp to the returned file uri to break the cache.
https://github.com/callback/callback-android/commit/3ebfb6717c149827f9b9b2ab2c31d5f2f44f6911
> WebView caching resized pictures
> --------------------------------
>
> Key: CB-17
> URL: https://issues.apache.org/jira/browse/CB-17
> Project: Apache Callback
> Issue Type: Bug
> Components: Android
> Affects Versions: 1.1.0
> Reporter: Simon MacDonald
> Assignee: Simon MacDonald
> Fix For: 2.0.0
>
>
> 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 + ")");
> }
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (CB-17) WebView caching resized pictures
Posted by "Simon MacDonald (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CB-17?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13163275#comment-13163275 ]
Simon MacDonald commented on CB-17:
-----------------------------------
My fix resolves the problem where the webview is caching the resize.jpg image. If you want to get the original file do a getPicture but don't specify a new targetWidth or targetHeight.
> WebView caching resized pictures
> --------------------------------
>
> Key: CB-17
> URL: https://issues.apache.org/jira/browse/CB-17
> Project: Apache Callback
> Issue Type: Bug
> Components: Android
> Affects Versions: 1.1.0
> Reporter: Simon MacDonald
> Assignee: Simon MacDonald
> Fix For: 1.3.0
>
>
> 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 + ")");
> }
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (CB-17) WebView caching resized pictures
Posted by "Simon MacDonald (Updated) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CB-17?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Simon MacDonald updated CB-17:
------------------------------
Fix Version/s: (was: 2.0.0)
1.3.0
> WebView caching resized pictures
> --------------------------------
>
> Key: CB-17
> URL: https://issues.apache.org/jira/browse/CB-17
> Project: Apache Callback
> Issue Type: Bug
> Components: Android
> Affects Versions: 1.1.0
> Reporter: Simon MacDonald
> Assignee: Simon MacDonald
> Fix For: 1.3.0
>
>
> 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 + ")");
> }
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira