It may make me look like an evil anti-perl (I can feel the downvotes coming!), but you could actually do the whole thing with JavaScript. screen.width and screen.height return int values for with width and height of the screen in pixels. Depending on the user's resolution you could proportionately scale down from the original image size.
But a real monk would take the time to learn to do it in Perl! (that's my anti-downvote disclaimer ;)
Don't worry about people stealing your ideas. If your ideas are any good, you'll have to ram them down people's throats.