WordPress.org

Ready to get started?Download WordPress

Forums

Auto Post Thumbnail
[resolved] WordPress 3.4: Stopped Working, Thumbnails Missing (87 posts)

  1. rowsdowr
    Member
    Posted 1 year ago #

    After upgrading to WordPress 3.4 I noticed that most of my Featured Image thumbnails were missing. It seems that thumbnails I had set manually were still displayed, but ones that were generated by this plugin wouldn't show up anymore.

    The missing thumbnails are gone from the front end and are no longer set as Featured Image on the Edit Post screen. They are still listed in the gallery but the their preview images are blank.

    When creating new posts, this plugin doesn't generate thumbnails automatically anymore.

    I looked around in the MYSQL database and noticed that thumbnails generated by this plugin don't have a _wp_attached_file entry in the _postmeta table. Manually set thumbnails, which still work, have _wp_attached_file set to their specific image URL. Maybe this has something to do with it?

    http://wordpress.org/extend/plugins/auto-post-thumbnail/

  2. Sirooz
    Member
    Posted 1 year ago #

    Same happened to mine thought the plugins had problems so installed another one same as for the other..

    Whats the solution for this ???

    :(

  3. raissuli
    Member
    Posted 1 year ago #

    Same here...

  4. DanStudio
    Member
    Posted 1 year ago #

    damn.. same problem. We need someone who could fix the database gently :) and update the plugin, too..

  5. gothickmatt
    Member
    Posted 1 year ago #

    If it's any help tracking this down, I found that on the theme I was using, *some* of the thumbnails weren't working, and some were. If I switched to the standard WordPress Twenty Eleven theme, *all* the post thumbnails appeared okay. So I think it may be a theme problem rather than a Auto Post Thumbnail problem, in my case. I'm still investigating...

  6. DanStudio
    Member
    Posted 1 year ago #

    But does "Twenty Eleven" show thumbnail or just the original image from the post? Seems that just an image.. Plus, we already know a possible solution..

  7. gothickmatt
    Member
    Posted 1 year ago #

    Good question, Dan. I've run out of lunch hour, so I'll have to check later. I've narrowed it down to get_the_post_thumbnail() returning empty for some of the posts when it's called from my theme, but not for others; I'll investigate further this evening, assuming nobody else has found the problem by then...

    EDIT: Okay, looks like it's the actual creation of the images in the media library that is the problem. If I clear and regenerate the thumbnails manually, I end up with broken images in the media library, i.e. there are entries for the thumbnails, but the images themselves appear blank.

  8. kb4i
    Member
    Posted 1 year ago #

    i have too this probleme and i need the file .zip to upgrade manualment this plugin
    thnks alot

  9. snowmoon
    Member
    Posted 1 year ago #

    Arrgghhh... Just upgraded to WP 3.4 and have exactly the same problem. I hope someone will be able to help us soon.

    Where the post thumbnail should be, it's showing the path location of the thumbnail. And the path is correct. So why isn't it showing?

  10. anychanh
    Member
    Posted 1 year ago #

    Hic, same.

    Hot fix pls :(

  11. cip6791
    Member
    Posted 1 year ago #

    Same problem here ... it seems that it's not just limited to Auto Post Thumbnail. I am using Auto Featured Image and also tried Video Thumbnails which don't work either.

  12. gothickmatt
    Member
    Posted 1 year ago #

    Yup, I think rowsdowr is definitely on the right track, the problem *does* seem to be that _wp_attached_file is missing from the metadata. Having problems tracking down why it's not there, though. The code in the plugin to create the attachment and its metadata all looks good to me.

  13. DanStudio
    Member
    Posted 1 year ago #

    well yep, but '_wp_attached_file' contains url to one specific image (with one size), while '_thumbnail_id' stores ID of the thumbnail, so any of the sizes (small, medium, large, ...) can be easily picked via our php query, i guess.

    Also tried different plugins, but seems like WP used that '_thumbnail_id' for ages, and now something went wrong :/

  14. DanStudio
    Member
    Posted 1 year ago #

    http://core.trac.wordpress.org/changeset/20646/trunk/wp-includes/post-thumbnail-template.php

    that's the link that shows what changes in 3.4 were made. We also see that WP still uses "_thumbnail_id". will try to delete changes and see what happens.

  15. gothickmatt
    Member
    Posted 1 year ago #

    Okay, I fixed mine like this. In auto-post-thumbnail.php, there's a line in apt_generate_post_thumb:

    $thumb_id = wp_insert_attachment($attachment, $file, $post_id);

    I think this is causing the problem because $file doesn't seem to be set at this point (or anywhere, in fact.) It's wp_insert_attachment that sets up the _wp_attached_file. Changing this to:

    $thumb_id = wp_insert_attachment($attachment, $new_file, $post_id);

    ...seems to fix it, though I needed to delete the broken images in the Media Library and then regenerate the thumbnails from the plugin admin page.

    I haven't had time to test that this is still generating the right sizes, etc. -- it just looks like the _wp_attached_file has to be there for the attachment to be recognised as an image at all, which is what's causing the fundamental problem.

    Anyone else have time to test this?

  16. misthero
    Member
    Posted 1 year ago #

    I found a solution without touching core files, adding:

    update_attached_file( $thumb_id, $new_file );

    on line 258 of auto-post-thumbnail.php

    it should look like this:

    before modification:

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

    after modification:

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

    anyway this will work for new posts only, if you want to update old posts you should delete the old attachments in media page, those that have a missing blank image icon and then reprocess old posts using the plugin options.

    Good luck!

  17. asialove
    Member
    Posted 1 year ago #

    edit the post.php

    Replace

    [moderated]

    with

    [moderated]

    Thanks

  18. oomskaap
    Member
    Posted 1 year ago #

    @misthero or @gothickmatt , is there an SQL query to bulk delete all "attachments" from posts. I have to many posts, it will take ages to do one by one

  19. oomskaap
    Member
    Posted 1 year ago #

    @asialove Your solution worked perfectly!! But i already deleted a lot of images in my folder, so now the featured images shows up as not found, do you know any query to bulk remove all attachments from posts? so i can generate them from scratch.

  20. gothickmatt
    Member
    Posted 1 year ago #

    There's no way I'm editing WordPress core files for something that looks like it can be solved by changing one line in the plugin :)

  21. asialove
    Member
    Posted 1 year ago #

    oomskaap, did you try the solution in my last post?

  22. asialove
    Member
    Posted 1 year ago #

    oomskaap, do not edit your database,, just leave it there,
    upload the images by ftp again to the folders..

  23. oomskaap
    Member
    Posted 1 year ago #

    @asianlove yes i did, and it worked perfectly. But unforunately before i tried it, i deleted all the generated thumbnails in my upload folder. So the old featured images are still "stuck" in there with a not found logo. Which means i have to click "remove feautured image" on all my post. But i have over 1000. Any bulk way to do it once ?

  24. DanStudio
    Member
    Posted 1 year ago #

    oomskaap, u need an sql-query smth like this:

    DELETE FROM wp_postmeta WHERE meta_key = '_thumbnail_id';

    but I didn't test it and do not take any responsibility for any troubles, you understand...

  25. misthero
    Member
    Posted 1 year ago #

    Auto update old posts without deleting after you applied my previous fix or the gothickmatt one you can use this modded version.

    http://www.mediafire.com/?1g701s5stxgivy7

    do a backup of your database just in case

    1. upload to plugin folder
    2. disable auto-post-thumbnail or auto featured images
    3. enable this
    4. go to the option page and press the red button
    5. wait.
    6. wait and do not refresh the page, depending on the number of posts it can be very slow, in my case it took 20 minutes for 4567 posts.

    this will process all your post and regenate working thumbnails only for videos. be careful it will generate a thumbnail even if it already exists, this is why it works, it will update the broken thumbnails, be patinent, the process is slow.

    When finished DISABLE this modded version and reenable your version.

    have fun!

  26. asialove
    Member
    Posted 1 year ago #

    try this to check if the "feature image" value is still stored in your database

    SELECT * FROM wp_postmeta WHERE meta_value like '%jpg%'and meta_key='_wp_attachment_metadata'

  27. esmi
    Theme Diva & Forum Moderator
    Posted 1 year ago #

    There's no way I'm editing WordPress core files for something that looks like it can be solved by changing one line in the plugin

    Good for you!

    People: Never, ever, edit core WordPress files.

    @asialove: Please stop advising people to edit core. If there's an issue with the plugin, fix it, Don't change core.

  28. oomskaap
    Member
    Posted 1 year ago #

    @DanStudio , worked like a charm! thanks to everyone in this thread. My site is up and working again with thumbnails restored.

  29. DanStudio
    Member
    Posted 1 year ago #

    oomskaap, great!

    I've came to this solution just an hour ago while reading about SQL queries )) Just wanted to clear thumbnail cache. I'm happy my investigation wasn't useless ))

  30. snowmoon
    Member
    Posted 1 year ago #

    I went with misthero's suggestion and added

    update_attached_file( $thumb_id, $new_file );

    to auto-post-thumbnail.php as I too didn't want to mess with core files. I then used another plug-in to removed all featured images from old posts, then re-generate thumbnails using the Auto Post Thumbnails plugin. Everything is back to normal now.

    Thank you misthero! :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic