Thank you. I commented everything in /enfold/config-templatebuilder/avia-template-builder/php/media.class.php
from line 78 down.
Nothing broke. Phew.
But your solution is better, of course.
Sorry! The theme works fine – it was NoScript in Firefox that caused the issue.