The MU forums have moved to

Is there a plugin which could get the first image of each recent post (sitewide) (3 posts)

  1. italways
    Posted 16 years ago #

    I think it is a good idea to put a gallery of the first image of each recent post on the main blog. Is there any plugin could do this? any hints? thanks!

  2. Radecki
    Posted 16 years ago #

    I looked into this for a while as well and couldn't find anything in mySQL that stores where images are and their relation to specific posts. IT seems like it's simply uploading an image to a specific folder and allowing you to put that image in your post.

    However i did work on a plugin that brings in the most recent posts from all my mu blogs. This by default was bringing in any image that was in that post. The problems came when I wanted to show only an excerpt of the post and not the entire post. In order to do this I had to strip out
    html tags because before I was truncating the text in the middle of an open tag.

    If you wanted to display images you would have to modify the code:

    $strippedDesc = strip_tags($desc); to be:
    strip_tags($desc, '<img>');

    Which would strip out all html tags except images. of course the image would have to be at the begining of the post so that the code will not truncate in the middle of an image tag. (Why i'm not using it)
    resave .txt file as ah-recent-posts-mu.php and add in mu-plugins file then in your home.php folder simply call
    <?php ah_recent_posts_mu(10) ?>

    Hopefully that gets you started.

  3. italways
    Posted 16 years ago #

    Hi, Radecki, thanks for your information! I found a such plugin for single wordpress, and it can generate thumbnail pics for display. The idea of this plugin is like you mentioned, search the first '<img>' tag in the post.

    do you have any idea about modifying it for wpmu? fist we need change the sql query to sitewide I think, thanks!

About this Topic

  • Started 16 years ago by italways
  • Latest reply from italways