I have that script too. You didn't tell us where you were trying to use it or any other details that could help but based on my experience I have an idea of what might be happening.
If you try to use this script on a category or detail page that has 4images private permissions set, the script won't work. The reason is because the php print script has no knowledge of the 4images user session. It runs in a separate process outside of 4images. Therefore as far as 4images is concerned, it behaves like the visitor is a "not logged" in user.
If you want to solicit more help, you really need to provide more details about what template you're trying to use this in, 4images permissions, etc. Any details you can think of. An example URL would really help others help you.
Good luck !