WordPress.org

Ready to get started?Download WordPress

Forums

Automatically generate image with new post (6 posts)

  1. danielmanis
    Member
    Posted 6 years ago #

    I would like to have an image that I can post on other websites that will show my most recent post. I figure the best way to do this would be to call a script that creates an image with the post title called newPost.jpg when create a new post. This way I drop the image code on a site and it always shows the most recent post no matter what.

    But I can't find how to do this. Can I be the first person to think of it? Certainly not, I hope.

  2. Michael Torbert
    WordPress Virtuoso
    Posted 6 years ago #

    If you're using PHP, it needs to be compiled with GD support in order to create a jpg. Why would you use an image for this? Why not just grab the text itself?

  3. danielmanis
    Member
    Posted 6 years ago #

    Because it would need to be compatible with Myspace. Is there a way to grab the text using just HTML?

  4. Michael Torbert
    WordPress Virtuoso
    Posted 6 years ago #

    Technically, you could with an iframe, though that's not a great way of doing things, and I'm not sure if Myspace allows iframes.
    Why not just have your RSS feed in your Myspace page?

  5. danielmanis
    Member
    Posted 6 years ago #

    I'd really rather have an image instead of a swf. Are there any plugins that you guys know of that will auto generate an image? That I can use and tweak to get the desired effects with a little tweaking.

  6. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    You could do this with some custom code. I can give you an idea of how, writing the code itself would take a lot more time.

    First, learn some basic PHP. Look for PHP code tutorials and such. Read them.

    Second, read this webpage. It tells you, generically, how to create an image on the fly with text in it. Make something like that, with temporary text that you want to use.

    Once you've got that working, all you need to do is to modify your script to use the latest post title instead of the temp text you used. To do that, you add code like this to it:

    require('./wp-blog-header.php');
    if( have_posts()) {
    the_post();
    $title = get_the_title();
    }

    That will get the latest title into $title, which you can then use in your own image generation code.

Topic Closed

This topic has been closed to new replies.

About this Topic