Fix image preview in dashboard

The JS had the wrong element IDs.

Fixes #1325