add onPhoto hook for improved performance