logic in photo display