Simplified SQL string generation. Maybe fixed a bug on some systems regarding the final img src generation.