Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

After W3 Total Cache update to the latest Version my Image Generator (Meme) WP Plugin dont generates a image. Imput Text and other frontend functions work fine, but after click on the generate image button it does not generate/uploads the image to the



Instead of the image I see this warning:

Warning: copy(/var/www/vhosts/domaindomain.com/httpdocs/custom-wp-content-folder/plugins/plugin-name/images/meme/30691398627524.jpg): failed to open stream: No such file or directory in /var/www/vhosts/domaindomain.com/httpdocs/custom-wp-content-folder/plugins/plugin-name/output.php on line 73

This is the mentioned part of output.php :

                $_pid = wp_insert_post( $my_post );
            $filename = $apath;

            $wp_upload_dir = wp_upload_dir();
            $upath = $wp_upload_dir['path'];
            $ufile = $upath .'/'. basename($filename);
This is line 73---> copy( $filename, $upath .'/'. basename($filename) );
            $filename   = $ufile;   
            $wp_filetype = wp_check_filetype(basename($filename), null );
            $attachment = array(
                 'guid' => $wp_upload_dir['url'] . '/' . basename( $filename ), 
                 'post_mime_type' => $wp_filetype['type'],
                 'post_title' => preg_replace( '/\.[^.]+$/', '', basename( $filename ) ),
                 'post_content' => '',
                 'post_status' => 'inherit'

            $attach_id = wp_insert_attachment( $attachment, $filename, $_pid );

            $thumb_attach_attr = wp_get_attachment_image_src( $attach_id );

            $postmeta_id = add_post_meta($_pid, 'thumbnail', $thumb_attach_attr[0]);
            require_once( ABSPATH . 'wp-admin/includes/image.php' );

            $attach_data = wp_generate_attachment_metadata( $attach_id, $filename );
            wp_update_attachment_metadata( $attach_id, $attach_data );  


The site runs on UBUNTU 12.04 with Plesk 11.5 +

Any idea? Thank you so much

share|improve this question
Link to your plugin and its source please. –  Rarst Apr 24 at 16:56

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.