It was easier than I thought to port my code into a WordPress plugin using this nifty plug-in. I can put HTML, php or javascript right into a widget without any hassle. It took about 5 minutes to get my photos plugin working as a WordPress widget.
Highly recommended if you are trying to put PHP code into a WordPress page: My Custom Widgets