I had this error message when uploading images in WordPress. Image dimensions were set to 0x0 and the thumbnails did not appear.
A quick scan of the Apache logs
PHP Warning: copy(/var/www/vhosts/thedomain.com/httpdocs/wp-content/uploads/thephoto.jpg): failed to open stream: Permission denied in
showed me that I needed to correct the permissions on the /wp-content/uploads directory to allow Apache to write to it.