Hi,
no that method is not good, first because it allows you to load an image and I have a static block, second because you have to intervene product by product.
The solution is on the function.php file, solution I found by myself.
I ask you for an extra effort for these solutions that are not always possible via theme and therefore create php code to add to the function file.
Good job.