WordPress 2.9 introduced a new feature called Post Thumbnails (a.k.a Featured Thumbnails) allowing you to assign an image to your post. This image can then be easily shown in your blog using a simple function. Mark Jaquith has written an excellent blog post explaining this new feature in detail, do read it if you are wondering how to get started or why post thumbnail widget does not show up in your admin section.
The current implementation of this post thumbnails feature has a few lacunae, the foremost being you have to assign this image manually to the post. So, for your thousands of posts that you created prior to WordPress 2.9 you will end up assigning an image to every post. Also, even if you are creating a new post with just one image in it, you must assign it as a Post Thumbnail manually. Another drawback is that you cannot assign the images inserted through URL as Post Thumbnails.
This is where my new plugin and in fact my first ever WordPress plugin – Automatic Post Thumbnail – comes into play. As the name suggests, the plugin will automatically assign a thumbnail to your post when you publish it. The first image in your post is used as Post Thumbnail. This is irrespective of whether the image is an uploaded image or inserted through URL. The plugin will do whatever it needs to assign it as Post Thumbnail.
If you want some other image as Post Thumbnail instead of the first one in your post, simply assign it manually and the plugin will respect your decision.
Also, sometimes it may be that you don’t want Post Thumbnail at all for your post even if there’s an image in your post. Unfortunately, the plugin is not advanced enough to read your mind but it can read the Custom Fields added to post
. Add a Custom Field skip_post_thumb to your post and the plugin won’t do anything for that post.
Installation
- Upload directory ‘auto-post-thumbnail’ to the ‘/wp-content/plugins/’ directory
- Activate the plugin through the ‘Plugins’ menu in WordPress
- Sorry, no more steps
Download PRO: Click Here
Download: Click Here
Changelog:
V 3.2.1
* Added code to correctly link the featured/post thumbnail with the post so that the Media Library shows the association correctly.
* Assigning title to the generated featured/post thumbnail by extracting it from the title of processed image.
V 3.2
Added support for creating featured thumbnails for custom post types as well. Batch processing will also generate thumbnails for any type of post.
V 3.1
Renamed Gen. Post Thumbnails to Auto Post Thumbnail and moved it under Settings menu.
V 3.0
* Added Batch Processing capability to generate post thumbnails for already published posts.
* A new menu item Gen. Post Thumbnails is added under Tools menu.
V 2.0
Added functionality to generate Post Thumbnail for scheduled posts. Thumbnail will be generated when scheduled post gets published.
V 1.1
Added a wrapper function using cURL for file_get_contents in case ‘allow_url_fopen’ ini setting is off.
Feedback, suggestions, patches, bug reports most welcome.

Nice plugin, but how do i know that the plugin is “ready” or produces “errors”. When starts the plugin? If i try to read a post?
Thanks for your work and time!
M
@Markus – Plugin will do its work only when you Publish the post.
Thanks for your answer. It is possible to inlcude a function that scan all old posts und add the thumb? It will be nice to add post_thumbs to all my old posts.
Thanks for your work and time! M
nice plugin, but what about the images that where not added using wp-media-uploader?
there was a time when we added an HTML code to add an image (…<img src=….). what about those posts?
@rami – That’s the beauty of this plugin. It can make any image as Post Thumbnail. The only condition is, that image must be a valid image and the URL should be accessible.
i had try but the _thumbnail_id dosnt appear in mysql ??
that means the image did not save as post_thumbnail.
can help? thank
sorry i had manage to do it in a new install wp. but it just for the file upload to media library, the URL insert not appearing, i found the problem is the image did not upload, the file name is created but is empty 0kb. did i done anything wrong? (the first image is an url out of the wordpress
Hi Aditya,
Thanks for the great plugin. But I’ve a problem with my WP iPhone App. When upload some photos from my iPhone I get a file with the size of 0 bytes after publishing. Could be a problem with the ending of jpeg or the stupid long filename like “l_2048_1536_63278495-65F1-4296-9F88-12023524C8FB.jpeg”
I’ve found the mistake. The allow_url_fopen was set to off.
Thanks!
But what is the difference with Get The Image ?
http://justintadlock.com/archives/2008/05/27/get-the-image-wordpress-plugin
Well, not much different. But my plugin looks only into the post for creating post thumbnail and custom field is used to skip auto thumbnail creation.
It works! Thank you for your plug-in. But can you fix the schedule post issue? It wont automatically detect a schedule post image unless re-published
Sure. This will be fixed in the next release. Thanks for reporting.
Thanks for the plugin and all work. My server doesnt allow allow_url_fopen, so,
any chance to that the plugin could use other resource that wouldnt need allow_url_fopen ?
@Gustavo – I have added a functionality to fetch the photo using cURL if allow_url_fopen is disabled.
HTH
I’m a happy user of your plugin. Fixing the scheduled post issue would make it perfect!
Thanks for this great plugin!
Hope the fix for the scheduled post issue will comming soon!
I want to use the plugin for a second blog with 1000 posts and to re-published any post to set the thumb….!
Hold on Folks, Aditya is on a vacation he will be back on Thursday and you will have a new release!
Plugin is now updated to work with scheduled posts as well.
Enjoy!
@Nik, @Lars –
Thanks for using the plugin and glad that you liked it.
The plugin works well with the scheduled posts. I tested it on my dev setup. But the wordpress itself is having problem with publishing the scheduled posts.
Here’s the long discussion on WordPress forum related to this issue -> http://wordpress.org/support/topic/343080?replies=72
Hiya,
I would like to batch upgrade all my 200 posts to include thumbnails. This is so I can migrate from my current text-based theme to a graphic-oriented one.
Is there any way to do this without editing each post?
Not possible at the moment. But I will add this feature soon as lot of people are requesting for this. So stay tuned …
Thanks. I appreciate it.
Hi Aditya…thanks for a terrific plugin. Would you also be able to include an automatic thumbnail for embedded videos? Currently videos don’t have thumbnails. I believe there are already plugins for this, but since I use videos only occasionally I thought it would be a good idea to combine them into this plugin. Is this possible?
I have site with post over 5000, and i upload image via file manager. how to generate? im try to active plugin but thumbnail still not show.
thanks
You are asking for a batch process kind of functionality which is not possible at the moment. I have plans to add this but no time frame is set at the moment.
Hi,
Great plugin. I never did like the “set thumbnail” setup on wordpress 2.9x… just found it awkward.
This solves that issue briliantly, I just do my post and forget about the thumbnail, and there it is !
but….
We ran into slight problem.
I have 1000 posts, using URL image mostly, NOT in wordpress, on our other server.
your plugin has a preg_match_all filter which misses any URL’s without quotation marks as in URL=”myimage.jpg” works. but URL=myimage.jpg does not.
I added the following more general filter., as you see your original is commented out here
// Get all images from post's body$pattern = '/]+src[\\s=\'"]';
$pattern .= '+([^"\'>\\s]+)/is';
preg_match_all($pattern, $post[0]->post_content, $matches);
/* preg_match_all('/]*src\s*=\s*["\']?([^"\'>]*)/i', $post[0]->post_content, $matches); */
With this small change, works like a charm, and picks up first image in post. All I need do is “update” an old post, or make a new one without thinking about it anymore.
Thanks for an amazingly useful plugin… now I just have to figure out a way to “update” 1000 posts quickly, but even then, this plugin will cut that time much shorter and work into future with our image urls.
great stuff.
Vince.
Thanks for your feedback and the code to improve the plugin functionality. But the code your provided isn’t working for me.
I tested it with a random image from flickr. Even the URL’s with quotation marks around failed to filter through the new pattern. May be you missed something while pasting the code here!
Hi Aditya, sorry about that.
here’s the code i’m using now.
// Get all images from post's body
$pattern = '/]+src[\\s=\'"]';
$pattern .= '+([^"\'>\\s]+)/is';
preg_match_all($pattern,$post[0]->post_content, $matches);
/* preg_match_all('/]*src\s*=\s*[\""\']?([^\""\'>]*)/i', $post[0]->post_content, $matches); */
The commented out preg_match is the original.
I found this to work great on our site, using now.
So far as the updating of all older posts to use the new post thumbnails, again, your plugin came to the rescue.
I did the following, I commented out the check for a post thumbnail… and allowed your plugin to generate one as needed.
Thus.
* Look for this id in the IMG tag.
*/
/* preg_match('/wp-image-([\d]*)/i', $image, $thumb_id);
$thumb_id = $thumb_id[1];*/
// Ok. No id found. Some other way used to insert the image in post. Fetch the image from URL and do the needful.
if (!$thumb_id) {
By commenting this out, I was able to just show 50 posts on an edit page, bulk select all, and hit the “update”.
All posts now carried a thumbnail,
I found if I left this live… it created the situation of attempting to create a thumbnail, being sometimes unsuccessful, and it would not REMOVE the not working thumbnail.
my commenting it out allowed it to roll over all posts and update the thumbnails successfully for all posts with images. in the content.
Once the website is fully caught up i’ll just uncomment that line and we’re back up to speed.
Hope that works for you. .
If you prefer, I have no issue with emailing you a zipped version of the one i’m using live now.
caveat: I use wp 2.92 at this time.
I have tested with wp 3.0, but not extensively, (on twenty-ten, qualifire, and sliding-door themes). I have not tested the bulk update method on 3.0 yet.
darn, I forgot… there is a small glitch somewhere in thumbnail handling… seems if one exists your plugin can’t create one, but if you view, say 50 posts in edit window…. your plugin tries to create thumbnails automatically if you have thumbnails showing in your admin theme.
So… it hangs.
here’s the change I found worked in your script.
// If we succeed in generating thumg, let's update post meta
if ($thumb_id) {
update_post_meta( $post_id, '_thumbnail_id', $thumb_id );
sleep(1);
update_post_meta( $post_id, '_thumbnail_id', $thumb_id );
break;
It seems by forcing a delay of 1 second , and having your plugin update the meta data again.. it catches the NEW thumbnail just created.
This puzzled me for a bit… not sure if this is correct programming.. but I needed a brute-force solution quick, so went this route. perhaps a dirty solution, but it solved it quick.
cheers.
Dumb question, does this plugin add a custom field for “thumbnail” in the post with the image location? And will it pull thumbnails for posts that are auto pulled (ie feedwordpress) by RSS?
Curious on how this integrates with a standard them that utilizes the Thumbnail custom field for its front page.
thanks!
I am populating a built in post meta data for post thumbnail. This feature was added in WordPress 2.9. I doubt whether older themes and the RSS are making use of this meta data. But you can always modify your theme to utilize this post thumbnail.
Read this post on how to achieve that.
Cool plugin, which is working for me in its basic state, though I’m having three issues.
1) The full size image still shows up on my front page. For instance if I want to put a 600×400 image at the top of my article, when I post it, on the front page it will show the thumbnail (good), with the full size image right next to it (bad). How can I remove the full size image from the front page while keeping the teaser text?
2) A linebreak is being inserted after the thumbnail on the front page, rather than the text wrapping around the thumbnail, which I would prefer. I can’t find where to change this in the code.
3) Is there a way to make the thumbnail a clickable link that links to the full article, like the title does?
Thanks!
@Batman
All the issues you have mentioned are more likely with your theme rather than the plugin. This plugin just works on admin side and doesn’t interfere in the display of posts.
So, for things like, linebreaks and link on thumbnail image, you will have to adjust your theme code.
BTW, nice to see that Batman is using my plugin.
Hi Aditya,
I was able to solve #1 and #2 that I posted above by editing my theme, but I cannot figure out #3 for the life of me. Can you offer any guidance on where I would even start? I don’t have a normal object to add the link around. Should I be editing the files in the plugin to do it?
This plugin recently stopped working for me. I updated to WP 3.0 and changed my WP directory to be a sub-directory of my blog on the same day. After that this plugin no longer worked, so I’m not sure which of the two is the cause.
Try to re-enable the plugin and see if it gives any errors. Might be a permission issue and if so, you will see the error message when you enable the plugin again.
Oh, interesting idea, but that didn’t work and I got no errors. It THINKS it’s working (it thinks there’s an image there which isn’t). Strangely – the images that were there before (when it was working) are not there now. If I clicke “Remove Featured Image” and update, then it will again think it’s attaching a thumbnail that isn’t there.
I have all relevant folders writable and I actually didn’t move my WP files at all; they were always in the subdirectory they’re in now; it’s the blog I moved.
Is anyone else able to use this with 3.0?
Yes – the plugin is working fine for me on wp 3.0.1 at http://tariquesani.net/blog
I have installed and activated the plug but nothing happened. Is there something more I need to do?
You need to have a picture in your post and then publish the post, Also your theme should be “Post Thumbnail” aware for you to see it
Is it possible to make it automatically link the thumbnail to the URL of the article it came from?
Please see http://codex.wordpress.org/Post_Thumbnails to understand the topic of Post Thumbnails.
Halo, there’s a plugin called Get The Image which is pretty easy to use, very robust and will do exactly that. You need to be comfortable editing your templates though.
Hi, just popped in to say
THANK YOU, this plugin worked miracles for me.
As per my previous note, I modified a few lines so that it picks up and inserts thumbnails on every post, with a couple of fixes for the matching scheme, works for me.
Now I can publish a post, and it’s all automatic, thumbnail in, and resized.
BUT>>>>>>>
I just built a little importer for my blog…. and proceeded to import about 1000 posts. This importer either creates or updates current posts.
The result was better than expected.
In the IMPORTER, I do NOT set the thumbnail, but let your Auto Post thumbnail plugin handle that.
Guess what… when the posts are published or updated, your plugin inserts the post thumbnail automatically with no intervention on my part at all.
it’s almost like it’s fully autoMAGIC now…
thanks, my blog/website is now almost like a full CMS system now.
cheers.
I have a strange issue. I’m using Auto Post Thumbnail on my WPMU site. The plugin works great…. but only on SOME of the blogs.
My site takes 25 or so blogs and via Sitewide Tags, places them all on a “main index” page. On about half of the blogs, the plugin takes the thumbnail and assigns it as the “featured image” the way it should. On the other half, a meta is created called “thumbnail” and a URL is assigned, but nothing is set for the featured image.
I’m at a complete loss as to why this is the case on HALF of the blogs, and not a universal issues.
Any help would be ridiculously appreciated…
Hi Aditya,
I posted this up above but I’m not sure you saw it all buried in a reply thread.
I was able to solve most of my issues by editing my theme, but I cannot figure out one of them for the life of me.
I would like the thumbnail to be a clickable link to the full article, just like the title is. Normally I could use the permalink function in wordpress to wrap the object in my theme. However, since these thumbnails are being generated on the fly they’re not really even referenced anywhere in my theme layout files, so where can I add the permalink to them?
Thanks for any insight you may have.
Hi, Batman. still struggling?
to get your theme to support thumbnails, use the following in your functions.php file
if ( function_exists( ‘add_theme_support’ ) ) {
add_theme_support( ‘post-thumbnails’ );
set_post_thumbnail_size( 80, 80, true );
set_post_thumbnail_size( 50, 50, true ); // Normal post thumbnails
add_image_size( ‘single-post-thumbnail-270′, 270, 9999 ); // Permalink thumbnail size
I added this thumnail size of 270 because it fits well with my them.. you can modify for your use.
I use this in the theme page where I wish to place the thumbnail.
In your them page, inside a loop you put
if(has_post_thumbnail()) {
the_post_thumbnail(‘single-post-thumbnail-270′) ;
(I’m on WP 2.92, but it worked in 3.0 too)
HTH..
vince.
Similar situation to others. 5,500+ posts on a photography site that all need thumbnails. Would love to know when this functionality is in place.
Great concept and plugin. Thanks for your work.
When working properly, there should be no issue with updating thousands of posts with thumbnails. You set your screen options to show 300 posts at a time. Then select ALL, hit “edit”, and just hit update… does that not insert all the thumbnails in one swoop?
I too experienced a few glitches, and made some changes to the plugin. and found I made a couple of small changes, and it now works great on wp 2.92 and 3.01.
Please view the results at
http://twojjs.com/x/1u26
or
http://greenspotantiques.com/wp/auto-post-thumbnail-changes-hope-it-works-for-you
The changes I made are clearly marked with
/* *************** Vince
For ME, the preg_match change helped with capturing all image URLs for inclusion. Arditya indicated it did not work for him,though.
for ME , the sleep and duplicate update seemed to solve the issue of some thumbnails not updating (or looking like they had updated but with a “ghost” image, not really there).
Feel free to use as you require. For me, it solved the issue simply and now I don’t even think of thumbnails at all, it’s all automatic. And as I noted above, it even seem to work with importers doing 500 posts at a time.
I have placed a copy at
REMOVED LINK on Vince’s request
for you to download if you wish — it is the current working copy I USE now,
Hope that helps.
If this solves any issues for you, please let the creator know, perhaps these minor changes will be added to the plugin itself later.
If it doesn’t work for youl, let ME know, and i’ll take down the info since that would mean it doesn’t help.
cheers.
vince
cheers.
Hi Vince – tried your plugin – did not return anything for me – sorry!
Ok, Tarique, if a no go.. can we do the following? please?
can you delete the section of my previous message above where I indicate the downloaded zip file available?
If not working for others, it only adds to confusion. sorry about that.
And thanks for the plugin, very handy on this end. Hope you get the batching of past posts worked out soon for others.
cheers.
(and a special apology to Aditya , I’m afraid I mispelt your name in an earlier note
Since lot of users are asking for better functionality of adding post thumbnails to existing published posts, I have started work on adding this feature.
Will keep you guys updated of the progress.
Thanks for your interest.
Aditya
Hi Aditya,
It looks like your plugin is just what i’m looking for and I’m glad to see you actually are available for help with it!
I installed it and activated it onto my site, I published a new post and it’s not working–is there anything special that I have to do to make it work.
I’m using Amazon Autoposter for my posts and I actually went to a scheduled post and published it manually and I don’t get the thumbnail on the home page like I want.
I’m using Gazette theme.
Thanks, I can give you url if you need it.
All,
A new version 3.0 of this plugin is now available with batch processing capability to add thumbnails for previously published posts.
Hope this will save a great amount of time for all the users of this plugin.
Aditya
I truly, truly appreciate that you’ve gone through the trouble to implement this. Thank you for putting in this feature
I have a slight problem which I could imagine others might have: I use Yet Another Photoblog as the interface through which I manage my photos. As such, it doesn’t store the files as attachments nor embed img tags within the body post; instead, it references an outside table which links back via the post_id. The schema for the table is as follows:
id (auto-generate)
post_id (ref back to post id in wp)
uri (format: /image. For example, /wp-content/uploads/2010/08/12011.jpg
Before I go off and completely screw up your code with a tweak to pick up this data, is it apparent to you what needs to happen here?
Any advice would be greatly, greatly appreciated.
The site (subdomain) on which I’m trying to get this to work is http://models.ipanemic.com/
Thanks again!
Nevermind. Got it. Building thumbnails now. Thank you, thank you for this utility. Perfect.
hi, great plugin but i am having trouble to make it works.
i just installed and activated and it seems all fine except that the thumbnail image on my first post using this plugin is not showing. if you have a look to my blog http://www.weloveveneto.com you will see that all previous posts, using a different widget, works fine but not my first one. does it take a while to upload it or is there any widgets that might cause some conflicts? thanks for your help
marta
@marta – You can check whether thumbnail was generated or not, from the edit post page. The Featured Image section should show the thumbnail if its generated.
Aditya, you are my hero of the day!! This update was just in time for me! Thx!
I have test it on our beta webpage (release next week). It works fine with 1000 postings! You can see the results at http://beta.schnappaholic.de
Thanks!
Hi, is there a way to modify it not to show the same image twice?
now it shows the original image and the thumbnail..
How can i set it up to see only the thumbnail?
Thanks
@dealtack – The plugin has nothing to do with this issue. Check your template file where the post is displayed. It must be showing the thumbnail using function the_post_thumbnail();
This function is generally used only on the listing page and not on the actual post page.
Aditya,
You just saved me hours and hours of work. Thank you very much for putting this together. I’ll be running this on our servers before Skatter Tech 3.0 gets launched!
Thanks!
Hey Sahas,
Nice to know that the plugin was helpful for you. And thanks for the appreciation.
All the best for the launch.
Aditya
hi aditya,
do you have aim or msn or gchat?
please email me.
Hey, amazing plugin. Howeve, I am using playmaker 3 theme.
It requires that I set a custom field “thumbnail” and i set the path for it. How can i make the thumbnail value automatically the thumbnail that the plugin creates.
@salees
You will have to make the following changes to the plugin code to make this work. But remember, these changes will be lost if you update your plugin. Here’s the code that you should add/replace –
Find:
$thumb_id = apt_generate_post_thumb($matches, $key);and replace with
$thumb_id = apt_generate_post_thumb($matches, $key, $post_id);Find:
function apt_generate_post_thumb($matches, $key)and replace with
function apt_generate_post_thumb($matches, $key, $post_id)Find:
require_once(ABSPATH . '/wp-admin/includes/image.php');and add the following just above it
add_post_meta( $post_id, 'thumbnail', $url );The above changes will add a new custom field “thumbnail” to the post with the URL of the thumbnail generated by plugin.
HTH
Thanks but i just did some new posts .. it is still showing the categories id image. And there’s no custom field in the post with the name “thumbnail”. Appreciate your help.
Here’s the modified code —> http://pastebin.com/VvqMrfde
Working for me. See if it works for you.
oki … it seem that i had to put update_post_meta instead of add_post_meta … however this gives me the whole url.
The viva zoom plugin works if i put //2010/09/image.jpg
It wont work if i put http://mywebsite/wp-content/uploads/2010/09/image.jpg
So in this case i need to change the $url into something else i dont know cause im a newbie
please help
Ok. Check this now –> http://pastebin.com/YFbBHtFY. Should work the way you want it to.
Hello Mooley,
I`m trying to use your plugin but when I try in my oficial page, this send a log message (apache log) that the plugin “premature end”, can I enable a “debug” mode, to try discover whats happening ?
I`m test too in a small blog, and work fine, the oficial have +- 5k image files
Tks
@Kadu – Is the plugin generating thumbnails for some posts before failing? If yes, then this is an expected behavior. Just reload the page generating the thumbnails and it will start from the post where it failed previously.
Yes, 16% of images, I will try now to reload a page.
Tks
I’m trying to reload a page, but still stop in 16%,
I’m looking in my database, after pass auto thumbnail, the number of posts without “_thumbnail_id” still the same.
I am not sure why this isn’t working for me, but a friend suggested that it may be the theme. I’m using BuddyPress Daily Theme by Tammie Lister at Logical Binary (Incsub) on WordPress 3.0.1. I also am running the latest version of Buddypress. It seems that the functions.php and home.php have the necessary calls in PHP. Any thougths what might be the problem?
If the plugin is doing its job, then you should see the generated thumbnail on the post edit page. Just open any post which you know has a image in post and this plugin has ran through it and check whether the thumbnail is generated.
Also, make sure that you have followed Mark’s instructions for adding support for this feature in admin. Link to his blog can be found on the top of this post.
Think buddypress ist not the not the cause of the problem. Works fine for me with BP 1.2.5 (Theme Incsub Scholar) and WP 3.0.1!
Hey Aditya,
I really love your “Auto Post Thumbnail” plugin on WordPress, it works great!
But is their anyway that I can insert a default image if the post has no image?
Some of my posts have no image and it just shows up blank and it does not look good on my blog, if you could insert a little code to include a
default image if there is no thumbnail that would be great.
I already have a default image ready I just need the code!
Thanks so much and keep up the great work!
-Dan
Probably a good feature to add meanwhile try http://wordpress.org/extend/plugins/default-post-thumbnails/ or if you rather delve into code see http://www.o-theme.com/features/default-wordpress-post-thumbnail-support/
@Dan – This should be easily achievable my adding the code for default thumbnail directly in your time. You just need a code like
< ?php
if ( has_post_thumbnail() ) {
// display the post thumbnail
} else {
// no thumbnail, show default one
}
?>
HTH
Is there a way to setup a cron job that will check posts automatically for me? without me having to login to wordpress
@logan – what do you want the cron job to check for? The plugin is already capable of generating a thumbnail for future posts when they go live. Is there anything else that you want the cron job to look for?
Hello Aditya, i have to say this: thanks! your plugin rocks. I tested it on live site with more than 200 posts and it went well. However, there’s a time where the theme is already use thumbnail stored in custom field so what we have to do is moving the path from meta_key for example post_plugin into _thumbnail_id. I tried to modify your plugin but it didn’t work well. Do you have any idea to do so?
Remember that _thumbnail_id doesn’t store the path of the thumbnail. It just stores the id of the image. The image in question has to be added to wordpress media collection so that it can get the unique id in order for it to be used as post thumbnail.
Ah, so the _thumbnail_id keep an ID not the image path? Sounds enlightening. I’ll tweak it again
I had been looking all over for something like this!! I switched to a theme that uses featured thumbs for the front page… I didn’t feel like going back to all 300+ posts to do this… Thank you!
Hi there, OMG, I wish i knew about this a month ago, spent last month trying to get “get the image” plugin to work with scheduled posts but can’t/
So I’ve installed yours but still now working so assuming I need adjustments to the code. Problem is, done so much fiddling, not sure where to find right place.
Site is http://www.trafficinternet.org. See Home pageleft? No images. the others still have the “get the image” code.
Any ideas. Theme is lifestyle 4.0 studiopress
Thanks
Sharon
just to add sorry, I changed the code to reflect a response above where the person was using theme using custom field. I changed my code and it still didnt work.
Sharon
no ideas how to get this to work with studiopress lifestyle 4.0 anybody? Using scheduled posts?
Sharon
Hello Aditya:
Is there a way your plugin sets the attribute “title” to the images?
I think it is not doing it.
Visit my site, some movies of the home page do not show the title if I hover them. If I enter the gallery and manually set the image as featured it works.
http://frasesdelapelicula.com/
Hello, it looks like the 3.2 upgrade has caused a bug in the auto post thumbnail. The thumbnail are no longer posting automatically unless you go to setting and manually run to generate the thumbnails. Will you look into fixing this soon?
Thanks for your time
Denise
@Denise – I tested the plugin with WordPress 3.0.1 and it seems to working correctly. You may want to revert to older version and test again – http://downloads.wordpress.org/plugin/auto-post-thumbnail.3.1.zip
so i got the images working by using this code in my home page:
‘alignleft’ )); ?>
BUT: the scheduled posts are still not showing images automatically. I have to go into the admin panel and press “generate thumbnails”
Can anybody help please?
SHaron
see this site for an example: http://www.newchristmas.info
sorry, half the php code is missing from my comment above.
Hello, I’ve a little problem with getting your plugin to work. After turning it on and manually used option generate thumbnails it generate empty thumbs for every of my 300 posts ( all of them have images in content).
So I’ve deleted thumbs from posts manually and run again ‘generate thumbnails’ option, but it ends the same. Now I have thumbinals thats leads nowhere and because of that not showing.
Plugin creates thumbinal ‘/wp-content/uploads/2010/11/krety8.png’ but I dont even have this catalog ‘/2010/11/’ on my server.
Can you please show me what I’m doing wrong?
@Lukas – Make sure that the uploads directory is writable by web server. The plugin creates the folders and files inside uploads directory when generating the thumbnails.
Hello Aditya, thanx for your quick answer. I’ve figured out that empty thumbs wasn’t fault of your plugin.
Plugin was generating empty thumbs because of wrong setting in wordpress default upload folder. I’ve changed it to wp-content/uploads and it worked! Thank you again for amazing plugin.
Hi Aditya …
I’m having the same problem as Denise… I’ve tried your suggestion to downgrade but it seems like the plugin is no longer automatically generating thumbnails… I to manually generate them now… I’m wondering if there was a bug or may be a plugin that might be causing this problem?
@KIt – I tried once again with my test setup of wordpress 3.0.1 and its working perfectly for me.
Can you setup another wordpress on the same server where you are hosting your site and test whether the plugin is working?
Same question as someone already asked before: can I setup a cron in cpanel to run it. Basically, I’m using wp-robot to automatically create posts with Amazon products, and it runs every few hours with a cron job. Since those posts aren’t created in the editor, I have to run the tool to create thumbnails for existing posts. I want to automate that process, so I don’t have to go back 6 times a day, just to make thumbnails. And if I don’t do it at all, my site looks like crap.
So. Any way to run it with a cron?
Great plugin, by the way. Most useful one so far.
No, currently its not possible to setup a cron job to generate the thumbnails. But I will look into the possibility of doing this. Cannot commit on the timeframe though. I will update you if I add this feature.
Thanks for using this plugin and appreciating my work.
Aditya
Aditya,
I noticed a huge change in functionality in your plugin after a recent update.
Previously it would automatically set the first image of a post as the “featured image.” And that was it. Perfect!
With the recent update, it is also selecting the first image from the body of a post even if it is “legacy media”. In my situation, these old-format files aren’t given an entry in the Media Library because they were uploaded before that feature existed. Your plugin is automatically creating entries in the Media Library for each of these files. Unfortunately, the process is messy. The addition of legacy-files results in tons of entries into the Media Library without titles. These files also haven’t been “attached” to a particular post either.
Do you have a suggestion on how I can tweak the plugin to ignore legacy files? Maybe even offering an option would be helpful.
@SK – This feature of adding an entry to Media Library is there from the first release itself.
If the image is not the part of Media Library, then the plugin fetches that image (considering that it is remote), adds it to media library and makes it a post/featured thumbnail. This is so because wordpress requires the post thumbnail to be a part of Media Library.
I do noticed that these images are not getting *attached* to any post. I am looking at this issue right now and will come up with a fix as soon as possible.
Finally, to have the plugin to ignore the legacy files (and the remote files as well), search for the following code in the plugin file and comment it out.
$thumb_id = apt_generate_post_thumb($matches, $key);On commenting the above code, the plugin will generate post thumbnails only if it finds the file from Media Library.
Thanks for reporting this issue.
Aditya
P.S. I think the plugin should now have a setting page where user will be able to manage various options.
Aditya,
Thanks so much for clarifying those details!
I’ve been using your plugin quite often on my beta test environment before I launch my new WP site. I’ve commented out the code and I just ran it. Works like a charm. I’m using it along with Alex’s Regenerate Thumbnails plugin. Saved me having to go through nearly 1000 articles, some of which have 10 images in them.
Anyways, I have another slight challenge for you.
In March 2008, WP switched from the old-school myimage.thumbnail.jpg to the new post-thumbnail technology. As a result, none of my old posts can be assigned a featured thumbnail. Even the Regenerate Thumbnails plugin won’t solve that issue, because it’s legacy media.
I could use your import feature, however, that will create new entires in the Media Library, when an “old fashion” entry already exists. Is there any way to upgrade those with a query?
File names for thumbs looked like this in the past: myimage.jpg and myimage.thumbnail.jpg
I went through my DB to dig into this a bit, here’s what I found: http://pastebin.com/TmLpzLUb
But seriously great work! Long-time WP users will definitely appreciate this!
@Saha – Thanks for the update. Nice to know that it worked for you after modifications.
Regarding upgrading from legacy media, I don’t think any upgrade path is possible as it includes change in every img tag in each post.
But one thing that I haven’t done in my plugin is, checking the image URL to find whether its local or remote. Right now, I am checking for a CSS class that wordpress adds for local images
. This might have to be changed (or added) to the code in order to support the legacy media.
I was about to release a new bug fix kind of version today but now will hold on and check what can be done for this issue.
You may want to follow me Twitter (@adityamooley) to know about the new release.
Aditya
@Saha – Update to plugin is now available but the better support for legacy media is still not there. Can you tell me the wordpress version which used to create such URLs? I will have to actually install it and try there.
Aditya
Thanks for the update! (Hopefully the comment out tweak still works.)
The change to the modern configuration changed when WP 2.5 was released on March 29th, 2008. You can see how upload styles changed by comparing the posts on my site before and after that day: http://skattertech.com/2008/03/
I also noticed another minor bug. All my pre-”March 2008″ have an in the Media Library for the image file I uploaded. So if I uploaded “myphoto.jpg”, it’s in the dashboard. However, the “myphoto.thumbnail.jpg” files, which were automatically created in the past, aren’t accessible anymore through the dashboard interface anymore. As I had shown you in pastebin example, notation of those files are still present in my database. (As I assume they would be with other people’s installations.)
Anyways, your “import feature” is causing those “*.thumbnail.jpg” files to be imported as a new entry into the Media Library. It’s not your fault, but it’s a bit annoying.
Here are somethings I noticed:
1) Regenerate Thumbnails plugin properly generates all the new file custom image sizes for all the old-format images in addition to the new ones. The “.thumbnail.jpg” file isn’t removed.
2) The post content of old article still has “.thumbnail.jpg” files in it. As a result, your plugin is targeting the first file in there.
My dream tool would need to do the following to fix all my hundreds of posts pre-2008. 1) upgrade the database post_meta entry 2) so a (possibly very dangerous) search and replace regex to fix the urls in the old posts from using “.thumbnail.jpg” to the new thumbnail files.
P.S. One possible solution would be for your plugin to do this when searching for the first file in a post. If it sees the img src value ending in .thumbnail.jpg, it would drop the ‘.thumbnail’ portion and set featured image for the original image.
Aditya,
What size image works best in posts for converting into a thumbnail? Most of my image thumbnails got chopped in half on my homepage when I ran your plug in. http://www.WriteToSell.com
Blair
@Blair – There’s nothing like *best image size*. Infact, my plugin doesn’t do the cropping job. I have left it to WordPress to handle it. You may want to take a look at Mark Jaquith’s blog post (link on top of this page) to understand how cropping of post/featured thumbnails work.
All the best.
The download link is broken and can’t update from inside of WordPress
Strange! Both the things are working for me. Can you please try again?
Aditya
Would it be possible to look for an image in the gallery of the post and to use it for the featured image instead of looking in the post content for the image?
The way my templates are setup it uses the featured image to display the image as a thumbnail on a page and as a picture within the post.
Thanks!
Fantastic!!! You made my day guys.
Hi Aditya,
I think the auto post thumbnail functionality for scheduled posts is broken (at least on our end). Any scheduled post doesn’t get the featured image (post thumbnail). If we publish directly it’s fine, but just not for scheduled posts. Is this something specific to us or did it break with the recent WordPress updates? (we’re on WP 3.0.3).
Thanks,
Jean-Paul
I dont know why your plugin doesnt work with my theme. I try regenerate thumbnail, no result. Publish a post, no result.
Can you check on my problem? If yes, i send you my wp login to see what the problem.
HI
got to say love your plug – in – it is so much easier than get the image for me as I can’t follow code much
however I’m the same as others here —
It only works if I go into it and push the button to update the images – it will not do it automatically.
not sure why this is – but open to suggestions to resolve.
Hi,
Is there a way for the plugin to generate thumnail every 5 hours automaticly without me pushing the button?
For some reason the plugin does not seem to work if the posts are coming from WordPress for iPhone. I have to go back to the web version and press the Update button for the post and then the Featured Image is created.
I’d love to see this fixed if at all possible.
Thanks for reporting this. Frankly, I never tested this stuff. Will try to get this fixed in the next release.
Aditya
We also saw this problem. We managed to fix this by adding the following line to the top of the plugin:
add_action('publish_post', 'apt_publish_post');The plugin still seems to work as described + iphone posting.
Great plugin, Aditya! I’m updating my theme right now at the Marketing Technology blog and this is just what I needed!
This plugin duplicaties the image if it can’t find the thumb-id in a css class. As a result the imagelibrary can get full of duplicates.
We’ve added the following code, which looks for the url in the local database and get’s the id from there. This code is added on line 255 in auto-post-thumbnail.php:
if (!$thumb_id) {
$image = substr($image, strpos($image, '"')+1);
$result = $wpdb->get_results("SELECT ID FROM wp_posts WHERE guid = '".$image."'");
$thumb_id = $result[0]->ID;
}
The plugin does not work. It adds no pictures to automatically. I use the Windows Live Writer. Please update. Thank you for your efforts.
Just updated to the latest version of this plugin and now my post images don’t show up. Tried uninstalling and reinstalling, no dice. Only way I get images is to regenerate button, seems like a few people are having this issue too. Really great plugin though anyway to go back to the older version?
@Erwin – I was using publish_post action in previous versions of the plugin. Recently I changed it to use transition_post_status as it is supposed to work for any type of content, even for the custom post types. For me, everything is still working fine but looks like I will have to add publish_post action back in plugin since lot of users are complaining after the recent release.
@TraXim, @Tim – What is the version of WordPress you are using? I can try to install that version and check the plugin with it.
What do you think of our solution to prevent duplicates?
Even that looks fine. But instead of replacing line 255 with that code, I would put it above the current condition on line 254. This is because, if a user adds an image by URL, wordpress won’t get it locally first. But for featured thumbnail, we need the image locally and that is what the code on line 255 does.
This was exactly what I meant. I saw your update to the pluging today and it’s identical to our code!
Regards,
Erwin Vrolijk
Snow
Its the newer Version, i think 3.0.1 or?
I am using the latest wordpress 3.0.4.
not 3.0.1
i have 3.1 xD
Well, your blog says its 3.0.4
. I am going to release a new version soon. Let’s hope it will work for you.
Thanks for great plugin.
One question. When the post is published via “Publish” button everything is ok and the plugin generates thumbnail. But when we have delayed posts(post is published without “Publish” button) the plugin generate no thumbnail.
Any help?
Thanks.
@TraXim, @Tim, @olmar – A new bug fix version of the plugin has been released. Please update and see if everything is working now.
Seems to be working for me now. Thank you for the quick update.
Its works thans the Plugin
It works! Thank you for the quick response.
This is a great plugin. One minor improvement would be to take the first thumb image. Instead of the first image. This can help speedup the website and save traffic. For example:
This plugin takes the first image, so 10 images = 700kb data
if it would take the first thumb it would be 150k for 10 images.
No point in resizing a 600×400 pixel image and showing it as 120×80 if there is already a small image that is 120×80.
Lisa,
I can say from my experience that the size you need is dependent upon the blog design. I need large featured images for my blog compared to yours which must only need small images so that wouldn’t work for everybody.
Great Job On The Updates!!!
Posts from my iPhone now automatically work with the plugin.
Thanks!
Thanks for such a great plugin!
How can i change the size of the image produced by the plugin. By default it gives me rectangular image and i want square.Please solve this problem!
Regards,
Hi.. firstly Im new to wordpress.. I have activated the plugin and generated thumbnails ( so you app siad) But where are they and how can I access them.. Where do they appear?
Sorry but Im a little confused..
Thanks for listening
@Mike – Read a post by Mark Jaquith about using featured thumbnails. The link to his post is in the beginning of my post.
Cheers.
Ok, can someone please help me? I just installed this and ran it and now my site doesn’t work at all. Take a look at the main page, it’s a bunch of errors. How do I fix this? Thank you.
Ok, it’s only a problem with the Bueno theme – just so you know. I’ve switched themes and everything seems alright so far.
Ok, after trying like 6 new themes I’ve decided I NEED Bueno. Please advise on how to fix. This is what shows up when I try using the Bueno theme.
Warning: getimagesize(D:\Hosting\6109288\html/wp-content/uploads/) [function.getimagesize]: failed to open stream: No such file or directory in D:\Hosting\6109288\html\wp-content\themes\bueno\functions\admin-functions.php on line 575
Warning: file_get_contents(D:\Hosting\6109288\html/wp-content/uploads/) [function.file-get-contents]: failed to open stream: No such file or directory in D:\Hosting\6109288\html\wp-includes\media.php on line 253
Warning: imagecreatefromstring() [function.imagecreatefromstring]: Empty string or invalid image in D:\Hosting\6109288\html\wp-includes\media.php on line 253
Catchable fatal error: Object of class WP_Error could not be converted to string in D:\Hosting\6109288\html\wp-content\themes\bueno\functions\admin-functions.php on line 580
Hi there Aditya…
So I love this plugin!! One problem I am having is that it is not saving a new image thumbnail with the dimensions it needs to be….it is simply resizing (scaling) the larger images, and this is creating blurry and pixelated thumbnails. The thumbnails are being scaled.
Any solution for this?
You can see what I am referring to by right-clicking on the thumbnails in my blog here:
http://www.interiordesignpro.org/blog/
I have in functions:
add_theme_support( ‘post-thumbnails’ );
set_post_thumbnail_size( 180, 180, true );
Also, when I click on the “Generate Thumbnails” button from your control panel, it does not do anything for older posts. I am having to go into each post and re-saving a new version for it to define a featured image.
Thank you for any help on this!!
- Jason
I use a theme that shows images simply attached to posts and I need to create thumbs for those…
Any way to set featured image from 1st post attachment even if the image has not been inserted into the post?
Thanks
I installed your plugin, so I can use it with Swift theme.
But I’m having error when I open plugin page, Firebug displays:
a.widget is not a function
wp-content/plugins/auto-post-thumbnail/jquery-ui/ui.progressbar.js?ver=1.7.2
Line 13
When I click Generate Thumbnails I get following error:
$(“#genpostthumbsbar”).progressbar is not a function
http://www.kgsport.info/wp-admin/options-general.php?page=generate-post-thumbnails
Line 150
I tried disabling all other plugins, but that didn’t help.
Do you have any idea what can be causing this?
I am having the same problem. Seems like jQuery is not being loaded properly or something. Maybe there’s a version mismatch?
I tried another plugin that also uses the jQuery-ui and it also breaks in the same way. Probably something about that in the newest version of WordPress (3.1) which breaks it.
yes ,I have the same problems.
Your plugin is magical, I swear.
Thanks
hi
this plugin don’t work for me , i think it is not compatible with wordpress 3.1. i hope new version comming soon.
Hi all,
Released a new version of plugin which fixes the Javascript error. The regular thumbnail generation of post add is working fine with WordPress 3.1
Let me know if the release solves the problem.
Aditya
thanks
now the plugin load but after the work done for the 2500 post nothing change , all my post still don’t have thumbnail. any solutions please ?