relative path to images determined solely in PHP, fixing issues with SEO URLs etc.

Replaced the method of counting the slashes in "pathToPHP" to determine
the relative path from the PHP to the images. Thus, the "baseurl" no
longer needs to be submitted from the JS to the PHP.

Script now works with SEO Urls of the /category/subcatory/article.html
kind which necessitate an additional "/" in the pathToPHP variable.
Furthermore, images can now be placed above the root directory as well.