I've used this code successfully in a Code Block:
In order to use this, open Design > Custom CSS > "Manage Custom Files"
Upload your "Cover Image" file (the image you want to display by default).
Click on that image in the file browser
Now in the CSS editor you will see a link that looks something like https://static.squarespace.com/Cover_Image.png
Copy that link and paste it in place of COVER_IMAGE in the code block
Repeat 1-4 with your "Other Image" (the image you want to d