Material Library Add-On

I would like to make an add-on that shows a list of material preview images, and when you click on an image it creates a node tree for that material.

I would like this to be a new side panel in the Node Editor (like a Tools Shelf for the Node Editor). The problem is two fold:
-> I don’t know how to make a new side panel;
-> I don’t know how to show a button as an image;

Can I have some help with this, I will give credit to whoever gives the answer.

check out the contrib addons of bf-extensions, there is a project of a cycles node material library


This is not really what I am looking to make.
I don’t want to an online material library with file downloads, I want to make a panel with buttons that when clicked build a node tree without haveing to download a file.