Umbraco/Reference/TextGen

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Graphic headlines with TextGen.aspx

Introduction

Textgen.aspx generates a graphic-headline depending on the parameters passed to it.

Preparations

Before you can use the TextGen feature you need to upload the TrueType font file, which you'd like to use. Font files must be placed inside the umbraco/config/fonts directory. You also need to create an entry for your font in fonts.xml which resides in the same directory.

There are many truetype fonts available in the windows directory 'fonts' folder.

Usage within the Rich text editor

You can insert a dynamically generated image into the richtext-editor by clicking the icon beside the Bold and Italic-icons (Two A's).

Usage within templates

Place the following code in your Umbraco template (ensure you url encode the text parameter):

<img 
alt="Your Text Here" 
src="/umbraco/TextGen.aspx?
	text=Your+Text+Here
	&font=arial
	&size=48
	&color=ffcc33
	&bgColor=ffffff
	&bold=1" 
border="0"/>

Parameters

Name Description Example
Text Text which sould be displayed.
text=my+first+text
Color Text color
color=ff00ff
Background Color Background color
bgcolor=00ff00
Font Name This is the name of the font file without the .ttf file-extension.
font=verdana
Size Text size
size=12
Bold If the value of this parameter is not null then the text will be bold.
bold=1

Flat URL's

You can use TextGen.aspx with flat/friendly url's by using This Plugin.