DISQUS

DISQUS Hello! Huddled Masses is using DISQUS, a powerful comment system, to manage its comments. Learn more.

Community Page

Huddled Masses

Joel Bennett's development blog...
Jump to original thread »
Author

Automatic images for headlines

Started by Jaykul · 9 months ago

I've created a WordPress plugin to generate (and cache) images for each of your post titles, in the font of your choice! ... Continue reading »

38 comments

  • [...] [...]
  • Many thanks - cool plugin.
    I only mentioned earlier in the WP forums that the ALA article would be a good plugin, and NMoose pointed me here.
  • [...] [...]
  • [...] [...]
  • Nice work, thank you. :) Is there any way to have this running twice, or to configure it so that I can replace the text for my dates as well, but in a smaller or different font?
  • Aurora: I've been thinking about that ... it's not hard to make it run on multiple sections, the trick is running with different settings. I figured out how to do it, but i think you'll have to edit the plugin for each place you want to call it. Anyway, gimme a couple of days, I'll release a new one ;-)
  • Woohoo! Great news, Joel. Thanks! I don't mind editing the plugin... it only makes sense, if only to change the name a little so I know what plugin is running for which option.

    I'll check back when I get back from vacation.

    I just noticed: do you notice that all your comments say they were posted on June 6? :)
  • wonderful idea... thank you for the effort.
    sadly i am unable to get it working.

    attempting to seek support in the WP support site:
    http://wordpress.org/support/index.php?action=v...

    any help there would be most welcome!

    dss
  • Aurora: tada! I am now using the "Header Image Generator":http://www.huddledmasses.org/wp-content/plugins/source.php?file=image-headlines.php plugin to generate the category images at the top of my site (it probably won't stay that way for long, I'm not sure I really like the look). The sample code in there for how to do the category images should be enough to let you plug it in wherever you want. If you wanted to, you could even mix this with the "acronym replacer":http://www.huddledmasses.org/wp-content/plugins/source.php?file=acronyms.php plugin and start putting images in random places in your text ;-p
  • [...] [...]
  • Just got back from vacation... gave it a try... it works beautifully! I changed the category stuff to date instead. It was very easy to do. Thank you!!!
  • I have more of a question than a comment...is the replacement.js file still used or does the php plugin replace the need for the javascript file...

    I apologize in adavance if it was in plain site but I was too blind to see.
  • Catherine, there is no replacement.js file involved. The plugin is self-contained.
  • Thanks Aurora!
  • [...] [...]
  • I've got an idea for your script that brings in a few improvements. If you're opposed to inline styles, however, this is not for you.
    If you replace the Line that creates the return value with the following code, you essentially incorporate FIR into it as well, instead of just plain-vanilla image replacement.

    $retVal = "<h2 class="replaced" style="height:{$height}px;background: url($cache_url) no-repeat top left;">$text</h2>" ;

    You'll also want to add a class to the stylesheet of your choice like this:

    h2.replaced {
    text-indent:-1234em; /*hide text*/

    margin: 0;

    padding: 0;

    }


    It seems to work pretty well for me.
  • [...] [...]
  • I have a correction/improvement. I now realize that my first attempt broke validation, even though Firefox rendered it correctly.

    This version is also much more useful for WordPress users who are using the provided stylesheet, or a variation of it

    Stylesheet Content:

    h3.storytitle {
    margin: 0;

    padding: 0;

    }

    h3.storytitle span {

    display: block;

    margin: 0;

    padding: 0;

    text-indent: -1234em;

    }



    PHP changes on line 70 of Joel's Plugin:

             $retVal = "<span class="replaced" style="height:{$height}px; background: url($cache_url) no-repeat top left;">$text</span>" ;


    Let me know if this works for you, if you try it.
  • I love your plug-in, it works fine for me. I am having a hard time getting it to validate, though. The page validates fine when the plug-in is deactivated. When activated, however, I get a string of "warnings":

    http://validator.w3.org/check?uri=http%3A%2F%2F...
  • Well, that's bizzare. My site validates fine [;)]

    Actually, you've got it configured wrong, you're putting the *whole* image tag in the title attribute of the link.
  • I noticed that, but I'm not sure what I configured incorrectly. I must be missing something. All I changed was the font path and the font size, then I Activated the plugin. Was there other configuration that I was supposed to do?
  • Fixed it. I wasn't using the $before option, so the text was being replaced by the image tag in the title attribute also.

    Thanks!
  • One feature that would be very cool is a max-line-length setting so it will wrap long titles on to two lines. Thanks.
  • Is FreeType required for this to work?
  • This requires both the GD library and the FreeType library.
  • I am trying to get this plug-in to work with the post date and I am unable to get it working, i changed the cache image folder and all the other necessary variables. and when i load up the site, i get a undefined error while creating image type of msg... what do i need to change the_date() function to. to get this to work???

    Thank you for your help and making such a cool plug-in !!!

    THANKSSS
  • I'm interested in using this plugin and have installed it. Do I set the configuration inside "image-headlines.php"?
  • Basically, yes. If you look at the comments in there (at the bottom) I hope it will be clear what you need to edit...
  • Thanks! Plugin was very easy to just drop in. I appreciate your work on this.
  • Actually, I've updated your delightful plugin to support text that needs to be broken into multiple lines. My site format is not as wide as yours, so longer titles caused me some overlap. You can find an example of a multi-line title here to see what it looks like in action. The code is available zipped up here. Please feel free to work this back in to the codebase if you so desire.
  • I'm unsure whether my comment got lost or is in moderation, but the trackback link above explains my modification to the plugin to support breaking long lines into multiple lines. You're welcome to roll the changes into your code base if you desire. Thanks again for a great plugin.
  • I just started using WordPress...
    Once the php is configured, where should I put it?
    In the plugins folder, or I have to paste it into the index.php code? If so: where? I want to use the plugin for the posts headlines (h3 in the standard CSS and index.php)
    Thank you in advance!
  • Ok, I put the php in the plugin directory and activated it from the admin panel. Now, instead of the post title I get this message: Warning: mkdir(): SAFE MODE Restriction in effect. The script whose uid is
  • Where are you having it store the cached images? Does that folder exist and have write permission for everyone?
  • Well, lots of questions:
    * The plugin goes in the plugins folder, yes. And you have to configure the plugin by editing a couple of places (to tell it about fonts and such)
    * I don't know much about PHP's safemode, but my guess is it's the fact that I'm caching the images that's a problem (ie: PHP isn't allowed to write out files), this could probably be modified to just out put the images (but it would be a bit slower when there were lots of them...)
    * The cached images are stored in a user-specified folder (specified as "$cache_folder"), and it needs to be writeable by the script,not by everyone (although frequently the easiest thing is to make it writable by everyone, that's not the _best_ way [;)]).
  • I've _finally_ gotten around to adding a "download" link to my source script. All of my plugins should be simple and easy to download now, just click through to the source and hit the download link.

    Hopefully that will solve all the download problems people have had.
  • Hi... sorry for my bad english but i'm italian... there is a way to show the tex on multiple columns?? I tried it in my kubrick themes butm for long post titles, the text appears out of the content box...
  • There is not a way to do that with this plugin .... honestly, it could be added without _too_ much trouble, but it's a significant performance hit, so I opted for keeping them short instead. The fact is, I never liked multi-line headlines anyway, so I just didn't take them into account. Of course, I'm not using it right now, so I'm not terribly motivated to fix it :-/

Add New Comment

Returning? Login