PHP Warning: file_put_contents on thumbnail folder

I’m getting a lot of this in the error_log.

PHP Warning: file_put_contents(/home/myuser/public_html/images/thumbnails/thumbnail_34_0_thumbnail_0166-1015112802402204c4eea5c1e37f.jpg) [function.file-put-contents]: failed to open stream: No such file or directory in /home/myuser/public_html/core/fn.fs.php on line 813

I’ve read the other post on this but it’s not permissions. Seems my folders have different names. Mine are detailed (large) and product (thumbs). Actually, for me this part (thumbnails/thumbnail_34_0_) in the above needs to go away amd all is well. I go to line 813 and I see the $filename argument. I need to know where it’s being called from so I can see about removing this? Don’t have a debugger at the moment.