Don't set variables inline here, set $preview above and check it here.