I'm not expert, but I think that's impossible, because how 4image will know that u add/deleted an image? php is server-side scripting, javascript - is client side, PHP has no idea what Javascript does and opposite.
yes, u can easily make a JavaScript that will change button from checked to unchecked, but it wont actual add/delete picture untill u execute the php file. (ofcource unless u use some <iframe> just to print the button..so it wont refresh whole page, but only that <iframe>