Rewrite book thumbnail upload to remove dependency on PEAR