Importing image textures?

OK, I’ve created a preview window for textures in folder. I got to the point where it displays my textures that are in the folder ,but I need it to import that texture into to blender when I change the picture and place in the texture slot. How do I get that working? LOL

OK, i kinda figured out the import texture and assign to texture slot. The only issue I have, is it’s a two step process and I want it to be one. I have to change the picture and then select a operator to import and assign. I want that to happen when I change picture.

Screenshot coming blenderartist will not load it right now.