Thursday, September 12, 2013

Editing any lockscreen to use image set from setbackground.cydget

With the setbackground.cydget, I have created a way to pick an image from your camera roll. Then set it to your lockscreen. What makes this great is, its easier to set wallpapers, and it can work across any cydget. I'll explain.

I can save this image you picked for further use. You can read more on that here.

I save this image file in LocalStorage. It is not a link to the image, but the actual image itself.

Most of the time you would create a wallpaper 

<div id="wallpaper"><img src=""/></div>

No matter what the image src you can change this image at any time by.

<style>#wallpaper{background: url('')}</style>

So if I was to take our saved photo. Which is saved as userbg. I just have to call it in my html.
any time to get something from local storage you can locatStorage.getItem("your saved entry")

We can open any lock background and add this script.

load();

function load(){

var getitems = localStorage.getItem("userbg");


 $('#wallpaper').css('background-image', 'url(' + getitems + ')');
}

All this does is pull the image from out storage, then applies it to the wallpaper via background-image. This in return overwrites whatever wallpaper the lockscreen used, and uses your own wallpaper. You can now pick any wallpaper via set background and it will set any cydget background to that image.

No comments:

Post a Comment