Posted by: DanalynJanuary 21, 2007 - 7:15 pm

Premium File Details

Version: 1.1
File Size: 13.8 KB

Price: $5.00

This is a premium download, you must be logged in to purchase. Use the links above to login or register.

EE Module: Title Images

A while back (during the second half of the 2006 Blogathon, to be exact), I wrote a quick and dirty module for Title Images in Expression Engine...for those of you who want to use non-standard fonts for your post titles.

Needless to say, the module had its faults.  So, 6 months later, here I am, rewriting and reworking the code (which still has caveats, but what doesn't).  Hopefully, this one is an improvement...although, I've been staring at code all day, so I may just be delusional.

The end result:

Title with default values

 
What This Does

  • Creates php-generated images for titles
  • Caches title images
  • Stores default values and settings in the database
  • Allows variations from the default settings by using tag parameters (which also makes it backwards compatible with the bass-ackwards first release of this module)

 
What You Need

  • Expression Engine (duh)
  • PHP (duh, if you're using EE)
  • GD with FreeType support
  • Note: Some fonts don't contain all characters, like curly quotes (which EE loves to replace straight quotes with), and you'll see empty blocks in its stead.  If this happens, you'll have to either figure out how to hack EE to not replace special characters, OR, find another font.

 
Instructions

  • Download and extract the zip archive to your hard drive
  • Upload the titleimg folder to your <system>/modules directory.
  • Upload the lang.titleimg.php file to your <system>/language/english directory
  • Specify and/or create a directory to store your TTF fonts, and upload TTF fonts to that directory (no fonts included with this plugin)
  • Specify and/or create a directory to store your cached title images, chmod the directory to 777 (read/write/execute ALL).
  • Activate the Title Image module in the Modules section of your CP
  • Edit the settings for the module in the Modules » Title Images section of your CP
  • Add the title image tags to your template(s):

    {exp:titleimg}{title}{/exp:titleimg}

Parameters:

You can also add parameters to change the font, size, color, background color, and transparency settings of your title images.

 
font=

{exp:titleimg font="BANANASP.TTF"}

Title with font parameter

Specifies a different font to use for your title image - use the exact file name of the font (must be located in the fonts directory specified in the settings CP).

 
size=

{exp:titleimg size="42"}

Title with size param

Specifies a size in points

 
color=

{exp:titleimg color="000000"}

Title with color

Specifies a 6-digit hex color (leave out the #)

 
bgcolor=

{exp:titleimg bgcolor="000000"}

Title with bgcolor

Specifies a 6-digit hex background color (leave out the #), good for anti-aliasing.

 
transparent=

{exp:titleimg transparent="off"}

Title with transparency turned off

Turns off transparency for a solid background color (shown above with a bgcolor of black because my current default is set to white)

 
width=

{exp:titleimg width="400"}

Title with 400 width

Sets a max width (in pixels) for titles before adding a line break

 
line=

{exp:titleimg line="200"}

Title with 400 width

Sets the spacing between lines (in pixels)