WordPress.org

Ready to get started?Download WordPress

Forums

Overwrite Uploads
[resolved] Will this plugin be updated? (6 posts)

  1. Hello,

    I've just run across your plugin via a wpquetions.com issue. The developer suggested your plugin as a fix for a Woocommerce issue of duplicating images. I too am having that same problem although would love to know if you are still maintaining this plugin before I start relying on it.

    Do you have plans for an update? Did you get any feedback from WordPress as far as installing the hook into the core?

    Thank you for your time and expertise. Guys like myself need guys like you :)

    Cheers
    Doug

    http://wordpress.org/extend/plugins/overwrite-uploads/

  2. khungate
    Member
    Posted 1 year ago #

    +1 on this

    I've installed on WP 3.5, followed instructions and it doesn't work unfortunately. I too am trying to fix and issue with Woocommerce. I'll be glad to donate if you're still actively working on this plugin.

  3. Ian Dunn
    Member
    Plugin Author

    Posted 1 year ago #

    I am planning on updating it when the WP core team adds the hook. It was slated for the 3.5 release, but got pushed back to 3.6. You can add yourself to the trac ticket to get e-mail updates on it. If it's important to you, leaving a comment on the ticket might help raise the priority of it, too.

    khungate, it works for me in 3.5. Could you start a new thread with a detailed explanation of problem?

  4. toto
    Member
    Posted 1 year ago #

    Its great idea for this plugin to work, they have to add the new filters.
    How we can help?

  5. toto
    Member
    Posted 1 year ago #

    Replace/Overwrite Media upload without loosing post thumbnails

    Try to check this code:

    // Force Media manager to overwrite files of same name?
    add_filter( 'sanitize_file_name', 'filename_filter_wpse_28439', 10, 1 );
    function filename_filter_wpse_28439( $name ) {
      // Get all attachments with same name
        $args = array(
            'numberposts'   => -1,
            'post_type'     => 'attachment',
            'meta_query' => array(
                    array(
                        'key' => '_wp_attached_file',
                        'value' => $name,
                        'compare' => 'LIKE'
                    )
                )
        );
        $attachments_to_remove = get_posts( $args );
        foreach( $attachments_to_remove as $attach ) {
            // Check all posts with this attacment
            query_posts('post_type=any&meta_key=_thumbnail_id&meta_value='.$attach->ID);
            if (have_posts()) :
              while (have_posts()) : the_post();
                    // Set temporal marker
                    update_post_meta( get_the_ID(), '_temp_thumbnail_id', $name );
              endwhile;
            endif;
        // Delete old attachment
         wp_delete_attachment( $attach->ID, true );
    
        }
        return $name;
        // Continue and upload new attachment with simple name
    }
    
    // Set new attachment to posts
    add_action("add_attachment", 'attachment_manipulation');
    add_action("edit_attachment", 'attachment_manipulation');
    function attachment_manipulation($post_ID) {
      $file = get_attached_file($post_ID);
      $path = pathinfo($file);
      $filename = $path['filename'].'.'.$path['extension'];
        // Check all posts for temporal marker
        query_posts('post_type=any&meta_key=_temp_thumbnail_id&meta_value='.$filename);
          if (have_posts()) :
            while (have_posts()) : the_post();
                // If found marker set postthumb with new attachment
      	        update_post_meta( get_the_ID(), '_thumbnail_id', $post_ID  );
                // Cleanup temporal marker
      	        delete_post_meta( get_the_ID(), '_temp_thumbnail_id', $post_ID  );
            endwhile;
          endif;
    }

    Is it useful, test for bugs, any suggestions?

    More discussions:

    WP 3.3 > Still no option to enable automatic image overwrites?
    http://wordpress.stackexchange.com/questions/37152/wp-3-3-still-no-option-to-enable-automatic-image-overwrites

    Hot to make on Upload New Media to replace files with same name?
    http://wordpress.org/support/topic/hot-to-make-on-upload-new-media-to-replace-files-with-same-name?replies=10

    How do I replace images without FTP?
    http://wordpress.org/support/topic/how-do-i-replace-images-without-ftp?replies=8

    How Do I Stop Incremental Naming In Media Library?
    http://en.forums.wordpress.com/topic/how-do-i-stop-incremental-naming-in-media-library

    Which filters or actions to use after a media upload and delete?
    http://wordpress.stackexchange.com/questions/56434/which-filters-or-actions-to-use-after-a-media-upload-and-delete

    Change attachment filename
    http://wordpress.stackexchange.com/questions/30313/change-attachment-filename

    How to force Media manager to overwrite files of same name?
    http://wordpress.stackexchange.com/questions/28439/how-to-force-media-manager-to-overwrite-files-of-same-name

    Enable Media Replace – Replace Images Instead Of Deleting Them And Re-Uploading
    http://www.wphub.com/enable-media-replace-wordpress-plugin/

    Automatically replace uploaded image with smaller one in WordPress
    http://random.kerola.nu/2010/09/08/automatically-replace-uploaded-image-with-smaller-one-in-wordpress/

  6. Ian Dunn
    Member
    Plugin Author

    Posted 8 months ago #

    Version 1.1 doesn't require modifying Core anymore.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic