added debug code

commit is pre-fixing the image placement bug as fallback.
two major changes to fix img placement

1) removed the delimiter ";" to now process the entire query result as a
string by replacing "jpg" with "jpg@", then splitting by the "@".
expensive client side and increases wait time; possibility to put
previous delimiting back in?
2) main cause of error was the wrong calculation of the random sequence
index, bc it was always going 1-100, which is wrong for resultsets that
are smaller than 100. reworked it so the index is now calculated with a
maximum not of the given "up to maximum", but up to count($result)
instead.