WordPress.org

Ready to get started?Download WordPress

Forums

Auto Featured Image
Thumbnails not showing after upgrade to 3.4 (28 posts)

  1. cip6791
    Member
    Posted 1 year ago #

    Youtube Thumbnails are no longer showing up on my home page after 3.4 wp upgrade. Is anybody else having the same problem?

    http://wordpress.org/extend/plugins/auto-featured-image/

  2. DanStudio
    Member
    Posted 1 year ago #

  3. Paul OFlaherty
    Member
    Posted 1 year ago #

    For the auto featured image plugin you need to delete all the broken, grey'd out unattached thumbnails from your media library.

    Then edit line 202 of auto-featured-image.php - find this:

    wp_update_attachment_metadata( $thumb_id, wp_generate_attachment_metadata( $thumb_id, $new_file ) );
    
    return $thumb_id;

    Replace with this:

    wp_update_attachment_metadata( $thumb_id, wp_generate_attachment_metadata( $thumb_id, $new_file ) );
    update_attached_file( $thumb_id, $new_file );
    return $thumb_id;

    Upload the plugin, find the settings page and regenerate the thumbnails.

    FYI - Misthero actually came up with the fix for the Auto Post Thumbnails plugin, but it also works for this one.

  4. Kevin Muldoon
    Member
    Posted 1 year ago #

    Adding update_attached_file( $thumb_id, $new_file ); to the plugin file seems to be the best solution.

    I've found that whilst the solution works and attaches images to posts, all auto generated images are still unattached. This doesn't seem to be a problem with displaying images just now though perhaps will be in the future.

    Any idea what needs to be changed to ensure new images are attacked to their corresponding post?

  5. Paul OFlaherty
    Member
    Posted 1 year ago #

    Yeah, the images are unattached in the media library but they appear properly as the featured image in the post. I haven't looked at attaching them to the post yet as getting my sites working was top priority for me. I'll update here if I find a solution for that.

  6. Kevin Muldoon
    Member
    Posted 1 year ago #

    Thanks Paul. I'm looking at the image.php file in the admin includes folder and checking to see if I can work this out.

    I'm deleting thousands of images from around 4 websites that use the plugin and then need to regenerate them. I don't want to go through it again so I'd prefer to get posts attached before hand before regenerating everything.

  7. Paul OFlaherty
    Member
    Posted 1 year ago #

    I feel your pain, had to do the same thing for thousands of images across our sites this morning. Let me know if you find a solution before I do :)

  8. Kevin Muldoon
    Member
    Posted 1 year ago #

    Will do. I'm going to write an article about it on http://www.wpmods.com but I want to make sure I have everything resolved before doing so. Nothing seems to be jumping out at me as being wrong though!! :)

  9. epicdiyom
    Member
    Posted 1 year ago #

    Thanks for the advice -- I was trying to solve this all day:

    http://wordpress.org/support/topic/media-directory-change-paths-and-database

    Your solution worked!

  10. crushlabs
    Member
    Posted 1 year ago #

    Just wanted to confirm that the above works better with Auto Post Thumbnail.

    Auto Post Thumbnail not only adds the photo as featured, but also attaches it correctly to the post. However, auto post thumbnail does not have video support that Auto Featured Image does. We'll be comparing and contrasting the two and adding the video functionality to Auto Post Thumbnail for our clients. If we have some time today, I'll make sure someone comes back and writes it out for you guys to copy and paste into your copy, if you'd like.

  11. Kevin Muldoon
    Member
    Posted 1 year ago #

    That would be fantastic crushlabs. I've found that auto featured image isn't working well at all now. Thumbnails aren't being assigned to draft posts and many other posts are missing thumbnails too. It seems very erratic.I've tried a few other solutions today but none seem to work that well.

    If auto post thumbnail works with video, I'd definitely switch over :)

  12. Paul OFlaherty
    Member
    Posted 1 year ago #

    I second Kevin on that crushlabs. If Auto Post Thumbnail supports YouTube and Vimeo videos I'd switch in a heartbeat :)

  13. Kevin Muldoon
    Member
    Posted 1 year ago #

    It's bizarre. The auto featured image seems to be working well on one of my websites but on the others it's not. No images are attached on any site though.

  14. Kevin Muldoon
    Member
    Posted 1 year ago #

    Any luck with this Crushlabs?

  15. prosperewebitor
    Member
    Posted 1 year ago #

    I have a long list of unattached, greyed out images to delete and would rather not have to do this. Is there an easier solution? And where do we add the

    update_attached_file( $thumb_id, $new_file ) line?

    Thanks

    Cynthia

  16. Paul OFlaherty
    Member
    Posted 1 year ago #

    Cynthia, as far as I know there is now easier solution and the code has to go in the auto-featured-image.php at line 202.

  17. StandOutSites
    Member
    Posted 1 year ago #

    Hi Paul, what's the easier solution now? Thank you

  18. Paul OFlaherty
    Member
    Posted 1 year ago #

    Sorry, I see my typo - that should read "there is no easier solution" as fat as I know.

  19. countparas
    Member
    Posted 1 year ago #

    Can't the dude that wrote this plug-in do something about this? And share an updated/fixed version of the plug-in?

  20. thetattedgeek
    Member
    Posted 1 year ago #

    i have tried the above steps to try and fix it but with no luck. Has anyone came up with anything that works? I do a lot of writing from my iPad and auto feature image really came in handy with this as the apps i use don't have a option for featured image! thanks

  21. binoyjacob
    Member
    Posted 1 year ago #

    Can someone tell me how to change the thumbnail size.

    Thanks,
    Binoy

  22. crushlabs
    Member
    Posted 1 year ago #

    Hi Binoy,

    I'm pretty sure that you'll have to "add_image_size" in your functions.php file for the specific thumbnail name and size that you would like.

    :)

  23. binoyjacob
    Member
    Posted 1 year ago #

    I am clueless on PHP. What's the script for that and where do you paste it?

  24. vincej
    Member
    Posted 1 year ago #

    once you get your thumbnails linked, and showing, as above... there is a simple solution for "attaching" these.

    I place this in my SINGLE.php file, and allow the viewer to attach them for me !
    It works great with past posts, as anytime a page is viewed, like by a robot... it does the magic for me, automatically.

    Once all your images are "attached" you can then delete this code if your plugins attach correctly for you. Or you can leave it, as it only acts upon checking to see if attachment is not correct before doing anything.

    if (has_post_thumbnail( $post->ID ) ) {
    
    $theid = get_post_thumbnail_id( $post->ID );
    $image = wp_get_attachment_image_src( $theid  , 'single-post-thumbnail' );
    $attached = get_post($theid)->post_parent;
    
       if ($attached = 0 ) {
    
    $thumbnailURL = $image[0];
    $newstring = strstr ($thumbnailURL, "20") ;
    delete_post_meta($theid, '_wp_attached_file');
    add_post_meta($theid, '_wp_attached_file', $newstring, true); 
    
    // Update post parent info, and sets the title of media to your post title
      $my_post = array();
      $my_post['ID'] = $theid;
      $my_post['post_parent'] = $post->ID;
    $my_post['post_title'] = get_the_title($post->ID);
    
    // Update the post into the database
      wp_update_post( $my_post );
    // echo the action, for checking.
    echo ' NOT ATTACHED, will attach now ->image: ' . $theid . '  url:' . $image[0] . '  post: ' . $post->ID ;
        }
    }
  25. vincej
    Member
    Posted 1 year ago #

    once you get your thumbnails linked, and showing, as above... there is a simple solution for "attaching" these.

    I place this in my SINGLE.php file, and allow the viewer to attach them for me !
    It works great with past posts, as anytime a page is viewed, like by a robot... it does the magic for me, automatically.

    Once all your images are "attached" you can then delete this code if your plugins attach correctly for you. Or you can leave it, as it only acts upon checking to see if attachment is not correct before doing anything.

    if (has_post_thumbnail( $post->ID ) ) {
    
    $theid = get_post_thumbnail_id( $post->ID );
    $image = wp_get_attachment_image_src( $theid  , 'single-post-thumbnail' );
    $attached = get_post($theid)->post_parent;
    
       if ($attached = 0 ) {
    
    $thumbnailURL = $image[0];
    $newstring = strstr ($thumbnailURL, "20") ;
    delete_post_meta($theid, '_wp_attached_file');
    add_post_meta($theid, '_wp_attached_file', $newstring, true); 
    
    // Update post parent info, and sets the title of media to your post title
      $my_post = array();
      $my_post['ID'] = $theid;
      $my_post['post_parent'] = $post->ID;
    $my_post['post_title'] = get_the_title($post->ID);
    
    // Update the post into the database
      wp_update_post( $my_post );
    // echo the action, for checking.
    echo ' NOT ATTACHED, will attach now ->image: ' . $theid . '  url:' . $image[0] . '  post: ' . $post->ID ;
        }
    }
  26. DougPete
    Member
    Posted 1 year ago #

    @vincej is there any downside to this? I don't know squat about php and I really want to use your code. I just upgrade a very old theme I've been using for three years and have more than 1,200 posts I want to attached featured images to.

    Guess I'm looking for reassurance. Can I get a hug? :-)

    Here's the site. It's using the latest version of both WordPress and the theme, but the theme hasn't been updated for two years and I've gotten my grubby hands on it to shove it around to do what I wanted to accomplish.

    http://www.words4it.com

  27. hamburgcity
    Member
    Posted 1 year ago #

    Hi,

    I can't activate the plugin after the bugfix:

    Parse error: syntax error, unexpected '}' in /home/www/doc/7964/testspiel.de/www/wp-content/plugins/auto-featured-image/auto-featured-image.php on line 353

    Cheers
    Marc

  28. hamburgcity
    Member
    Posted 1 year ago #

    Okay, this is another bug. I fixed it. ;-)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic