WordPress.org

Ready to get started?Download WordPress

Forums

New plugin: Post Thumbs (85 posts)

  1. callmeforsox
    Member
    Posted 7 years ago #

    Hi everyone,

    I made a new plugin called Post Thumbs to share. It has barely been tested, so if anyone tries it and has some problems hopefully I'll know what's wrong. It works on my site fine.

    What it does is scan a post for an included image and convert that image into a thumbnail to be used in The Loop. You could use this to show a list of posts as thumbnail links if you wanted. It will only work for images that reside on your server. No support for cross domain images as of yet.

    The documentation is shoddy, but it'll have to do for now. If anyone has any suggestions, feel free to reply. The plugin is here.

  2. halfbloodprince
    Member
    Posted 7 years ago #

    Nice work, sunscream. I think a lot of people are going to like this plugin -- I know I like it! I've been waiting for something like this for a long time!

    Your site looks pretty decent as well :)

  3. Marcomail
    Member
    Posted 7 years ago #

    i have this error:

    Warning: getimagesize(/home/.dodge/user/domain.com/images/image.jpg): failed to open stream: No such file or directory in /home/.dodge/user/domain.com/wp-content/plugins/post-thumb/post-thumb.php

  4. WPChina
    Member
    Posted 7 years ago #

    This looks great! However, is it possible to limit it to only one category? For example, I only want to show the most recent 8 posts from cat=3. Is this possible?

  5. Marcomail
    Member
    Posted 7 years ago #

    for me don't work, the plugin doesn't create any thumb...i don't know which is the problem

  6. WPChina
    Member
    Posted 7 years ago #

    Nope, I can't seem to get this working... do you have clearer details on what to include in the loop? Sorry, I know I am slow sometimes.... ;-)

  7. callmeforsox
    Member
    Posted 7 years ago #

    @Macromail

    I think that problem may be related to the base path you have to set. I would suggest making a small file called test.php and upload it to your root folder on your server. In test.php, write

    <?php echo $_SERVER['DOCUMENT_ROOT']; ?>

    Navigate to that file in a browser and it will echo the base path you should use (hopefully). Did you set the base path to "/home/.dodge/user/domain.com"?

    @WordpressChina

    I'm not sure which part you are having problems on, but this is what I have put in for my sidebar.

    <?php
    $posts = get_posts('numberposts=6&offset=9&order=DESC');
    foreach($posts as $post) :
    setup_postdata($post);
    $post_link = tb_post_thumb(true,$post->post_title);
    if ( !empty($post_link) ) {
    echo $post_link; }
    endforeach;
    ?>

  8. WPChina
    Member
    Posted 7 years ago #

    Ah, ok, great, yes using your code works--almost. I have the pics appearing now just fine. However, there are no links on them to their respective posts... also, is there a way for me to line them up one on top of each other, instead of in a row?

    Tks!

  9. callmeforsox
    Member
    Posted 7 years ago #

    For linking, instead of just echo $post_link, you could do this.

    if ( !empty($post_link) ) {
    ?><a title="<?php the_title(); ?>" href="<?php the_permalink(); ?>" class="highlight"><?php echo $post_link; ?></a><?php }
    endforeach;

    You could use an unordered list for putting them on top of each other and use css to format it however you want.

  10. WPChina
    Member
    Posted 7 years ago #

    Perfect! Works fine now. :-)

    This is an awesome plugin!

  11. callmeforsox
    Member
    Posted 7 years ago #

    For anyone using this, it has been updated. You can now specify a regular expression to check if a post has a video file (actually I guess anything) and use a different default image for that. Just make sure you use the right regex like for wp-extreme video it will need to find [gv data=... Also, fixed some coding issues for crop / resize and added an option to crop an image after resizing. Remember to escape your regex on double quotes.

  12. thenewsguy101
    Member
    Posted 7 years ago #

    I access my website at http://steve.asmallorange.com/~username , and because of the tilde, I get the following error:

    Warning: preg_match() [function.preg-match]: Unknown modifier '~' in /home/username/public_html/wp-content/plugins/post-thumb.php on line 45

    I replaced it with %7e, but that gave me the same error for the %. Am I doing something wrong? Help appreciated, this plugin would be perfect for what I need.

  13. callmeforsox
    Member
    Posted 7 years ago #

    I have uploaded a fixed version. Please tell me if you still get the same error.

  14. thenewsguy101
    Member
    Posted 7 years ago #

    Nope, I'm getting the same error. I noticed that all my settings were saved, even though I deactivated, reloaded correct plugin files, and activated.

    Is there something else I need to do to remove the plugin, maybe?

  15. callmeforsox
    Member
    Posted 7 years ago #

    Oops, sorry. Please, download again. The fix seemed to have not uploaded correctly. Right click, save as just in case it's still cached. Settings should still be saved.

  16. thenewsguy101
    Member
    Posted 7 years ago #

    Good news: Errors are gone! :D

    Bad news: Image still hasn't appeared. Since there's no error, I'm assuming it's detecting the file and all the paths are correct, right?

    EDIT: It's not a permissions error. I tried echoing the value of the tag instead of displaying it automatically, and it displayed the link. I might use that as a workaround, but that's where the problem is, FYI.

    By the way, thanks a lot so far. It's really a nice plugin, and I'll definitely link back to you once the site's finished. :)

    And here's my HTML/PHP:

    <div class="post-image"><?php tb_post_thumb(true); ?></div>

    Final question: Does the plugin work if my index uses the_excerpt() and not the_content()? If so, does it check the excerpt for images, or only the content?

  17. callmeforsox
    Member
    Posted 7 years ago #

    For your html/php, try this:

    <div class="post-image"><?php echo tb_post_thumb(true); ?></div>

    I think all that matters is it should be used in The Loop.

    Edit: Oh yea, I see you already found that out. I made it so you have to echo yourself.

  18. xinfo
    Member
    Posted 7 years ago #

    sunscream good work

    well i have two questions

    1, do this work if i hosted the image in some image hosting website ?
    2,i am working currently in local system using netserver

    then what will be my base path ?

  19. callmeforsox
    Member
    Posted 7 years ago #

    As of right now, it can only play with images on the local server.

    I have never used netserver, but try creating a php script and put echo $_SERVER['DOCUMENT_ROOT']; in it and run it to see if that will give you the base path.

  20. theiconoclast31
    Member
    Posted 7 years ago #

    Just a request: I'm using the plugin to generate a thumbnail for my front page, but I'd like to generate a smaller image on my Archives page, because it would take too long to load 10 or 20 400x400px images. Also, maybe all the thumbnails should be stored on a single directory so that they aren't scattered around everywhere. I'd like to know where my images are, y'know?

    But I don't mean to come off as unappreciative - this is a brilliant plugin. Thank you :)

  21. Marcomail
    Member
    Posted 7 years ago #

    i'm trying the plugin in my apache local server:

    domain name: localhost/domainname

    Default image: http://localhost/domainname/wp-content/default.jpg

    Full domain name: http://localhost/domainname

    Base path: d:/programs/easyPHP1-8/www/domainname

    When is create the pthumb, after i have submitted an article ? I try to submit an article but now wp doesn't show me any article in the homepage...i must delete tb_post_thumb to whow it correctly...i don't know why

  22. emanoelmelo
    Member
    Posted 7 years ago #

    I have a urge problem! The script works very very fine, and i'm very grateful for your contribution, but there's a problem about the files and folders the script creates: i can't delete them! The ftp says that i have no permissions for delete, move or even change permissions of these files. In fact my host admin said that the script creates the files as an general user and only it can delete this files, except if i change it for creating the files as my username, something like that. How can you help me? =\

  23. feverinlove
    Member
    Posted 7 years ago #

    Does this plugin create thumbs for posts that are posted before?

  24. callmeforsox
    Member
    Posted 7 years ago #

    @Macromail
    I'm not sure what the problem with that is. It does not do anything when posting an article. It will only do something when it's called. Might view source to see what's going on or maybe it's a php error.

    @emanoelmelo
    Sorry you had this problem. I think it's attributed to a sticky bit in the script. If you can open up the script and search for sticky bit there should be a line like

    if (!is_dir($save_dir)) mkdir($save_dir,01775);

    change 01775 to 0777

    I'm not sure if this will work since my host doesn't have this problem, but I think I've experienced it before.

    @feverinlove
    This plugin will create thumbs for any post as long as the function is called in the loop.

  25. feverinlove
    Member
    Posted 7 years ago #

    hi, your plugin is great :) Its what I have always thought of.

    I added "<?php echo tb_post_thumb(true); ?>" after " <?php while (have_posts()) : the_post(); ?>" in index.php

    And then Added "<?php
    $posts = get_posts('numberposts=6&offset=9&order=DESC');
    foreach($posts as $post) :
    setup_postdata($post);
    $post_link = tb_post_thumb(true,$post->post_title);
    if ( !empty($post_link) ) {
    echo $post_link; }
    endforeach;
    ?>" on sidebar.php

    Its not showing any thumbnails because the image sources are all linked to base url.

    check it here: http://www.cherez.com
    they are at the bottom of the sidebar.

    they only show alt text

  26. feverinlove
    Member
    Posted 7 years ago #

    and when I looked at the wp-content/uploads folder there is no pthumbs folder.

  27. feverinlove
    Member
    Posted 7 years ago #

    I got it working :)

    I got one question: I want to change the thumbnail size from 60 to 70. Is there anyway that the plugin can regenerate the thumbnails?

  28. theiconoclast31
    Member
    Posted 7 years ago #

    feverinlove

    Try deleting them via FTP or your webhost's control panel. If that doesn't work, you'll just have to contact your webhost and ask them to do it.

    @emanoelmelo
    Sorry you had this problem. I think it's attributed to a sticky bit in the script. If you can open up the script and search for sticky bit there should be a line like

    if (!is_dir($save_dir)) mkdir($save_dir,01775);

    change 01775 to 0777

    Actually, this isn't working for me for some reason.

  29. feverinlove
    Member
    Posted 7 years ago #

    can we have the plugin to place images on next/previous post links?

    taken from default theme: <?php next_post_link('%link »') ?>

  30. theiconoclast31
    Member
    Posted 7 years ago #

    Remove the %link>> and echo the post-thumbs function instead.

Topic Closed

This topic has been closed to new replies.

About this Topic