by Howard Miller.
I'm going to start with - there is a bug in your script.
As you don't tell us what it does, why you did it (simpler than what?) then it's very hard to help.
Check....
1. Does your script add a closing ?> to the end of the config.php file? If so, don't, delete it.
2. Switch on Debugging. Right click on one of the broken images and display it in a new tab or window. What happens?