If it's any comfort. You are not alone. Many people are having trouble with this particular function.
I suggest you browse through the (older) messages of this particular forum since so many people asked recently and some pretty good answers were given.
In fact, some of the answers got me started and it's working fine now.
Except now he wants to create a temporary file before showing the picture and that doesn't work ;-(((