Display image attachment in phonegap Android

61 views
Skip to first unread message

Olivier Picciotto

unread,
Jan 2, 2015, 5:37:28 AM1/2/15
to mobile-c...@googlegroups.com
Hello,

Displaying and image attachment using phonegap should be very simple as you could use a 

<img src="http://localhost:<port>/<database>/<docid>/<attachmentname" />

To display an attachment image..

Unfortunately, as Couchbase Lite on android requires basic authentication to be accessed by http requests , this will fail with a 401 error. Basic Auth can be done easily using ajax but in this case it is the webview issuing directly the HTTP request to get the image.. So how can we set up the basic Auth crendentials ?

 

Traun Leyden

unread,
Jan 8, 2015, 6:47:06 PM1/8/15
to mobile-c...@googlegroups.com

J. Chris Anderson

unread,
Jan 16, 2015, 1:37:49 PM1/16/15
to mobile-c...@googlegroups.com


On Friday, January 2, 2015 at 2:37:28 AM UTC-8, Olivier Picciotto wrote:
Hello,

Displaying and image attachment using phonegap should be very simple as you could use a 

<img src="http://localhost:<port>/<database>/<docid>/<attachmentname" />

To display an attachment image..


I tested this and it works properly on Android. The img src URL needs to include the basic auth credentials in the form http://user:pass@host:port/dbname/docid/attachment.file
Reply all
Reply to author
Forward
0 new messages