Use camera image as div background

157 views
Skip to first unread message

danmyaz

unread,
May 18, 2012, 5:55:39 AM5/18/12
to phon...@googlegroups.com
Hi,

I've used the code from the full example on http://docs.phonegap.com/en/1.0.0/phonegap_camera_camera.md.html, which is working fine.

Does anyone know how to then use the image (from photo album and also captured) as a background image for a div?

I've tried the following but can't get it to work:



// Called when a photo is successfully retrieved

//

function onPhotoURISuccess(imageURI) {

// Uncomment to view the image file URI

//console.log(imageURI);



// Get image handle

//

var largeImage = document.getElementById('largeImage');



// Unhide image elements

//

largeImage.style.display = 'block';



// Show the captured photo

// The inline CSS rules are used to resize the image

//

largeImage.src = imageURI;



$('div.mydiv').css('background-image', 'url('+imageURI+')');


}

Thanks

Dan
Reply all
Reply to author
Forward
0 new messages