If I use a portable version of ghostscript for ms windows with no registry entries created and all that buzz, it needs a variable GS_LIB set to the folder with gs_init.ps (i. e. the lib folder inside ghostscripts install folder), else your OOoLatex.sh script complains silently when executed standalone.
So I would put a pipe to your error function after all your $gs calls (`|| error gs' or `> gserror.log 2>&1') and have a look.
Solution: Hint the user to set the GS_LIB variable or inject a parameter to the gs call like `-I$GS_LIB' which may be needed when using the script from the extensions context.
Btw I found a typo in the $gs call for the png file generation, instead `-dSAFTER' the parameter has to have the name `-dSAFER'.
I attach a sample file adapted to the above.