They did want to install ImageMagick so I looked @ perl but I found the following solution for PHP.
Go to you php.ini and activate :
safe_mode_exec_dir = /some/path/to/dir
After setting up the directory take the following step :
cp /usr/local/bin/mogrify /some/path/to/dir
Done this ? Then you can use the following line (well at least I did :)) :
<? system("mogrify -resize ".$w."x".$h." ".$the_file." "); ?>
This should do it or just get you started !