If you wrote the script yourself, couldn't you just add an optional "rightload" parameter, that if set just "echo"s the final URL instead of redirecting to the image? Then you could setup Rightload to upload the picture with that parameter set and easily extract the URL.