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
Set the User and Group to the "webuser" and do "chmod -R 711 /some/path/to/dir" to protect it from users who are not allowed to know ;) .
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 !