I am running a nearly fresh image of Raspbian Stretch 4.9 with a desktop and have a program which creates a new image for the computer background every few minutes.
I had exactly the same issue, except I am running Lubuntu 17.04. It appeared lately after a recent update, though cannot pinpoint when. After lot's of research I became suspicious that one of the XDG enviromental variables must be exported too. Following some trial and error, I found that exporting XDG_RUNTIME_DIR solved the problem for me. You may want to give it a try.
To figure out the value run: echo $XDG_RUNTIME_DIR
The working wallpaper changer running from cron for me now looks like:
#!/bin/bash
...
export DISPLAY=:0
export XAUTHORITY=/home/krisz/.Xauthority
export XDG_RUNTIME_DIR=/run/user/1000
pcmanfm --set-wallpaper=${dir}/${file} --wallpaper-mode=crop
...