home.php new image rotation algorithm