PHP Classes

File: demo1.php

Recommend this page to a friend!
  Classes of George Clarke   ATextImage   demo1.php   Download  
File: demo1.php
Role: Example script
Content type: text/plain
Description: Used with demo.html, Displays the nine possible positions of text, plus shows multiple groups of lines of text on the same image.
Class: ATextImage
Layout and render text on images
Author: By
Last change:
Date: 18 years ago
Size: 1,729 bytes
 

Contents

Class file image Download
<?php
require "class.atextimage.php";
$timg = new ATextImage();
$timg->SetFont("arial.ttf",14);
$timg->SetBackground(255,255,255);
$timg->SetTextColor(255,0,0);
$timg->SetPos("left","top","center"); // (horizontal,vertical) positions,horiz justification
$timg->AddLine("upper");
$timg->AddLine("left");
$timg->MakeImage(300,200);

$timg->SetTextColor(0,255,0);
$timg->SetPos("center","top","center");
$timg->AddLine("upper",TRUE);
$timg->AddLine("center");
$timg->MakeImage(0,0);

$timg->SetTextColor(0,0,255);
$timg->SetPos("right","top","center");
$timg->AddLine("upper",TRUE);
$timg->AddLine("right");
$timg->MakeImage(0,0);

$timg->SetTextColor(255,0,255);
$timg->SetPos("left","center","center");
$timg->AddLine("center",TRUE);
$timg->AddLine("left");
$timg->MakeImage(0,0);

$timg->SetTextColor(250,200,100);
$timg->SetPos("center","center","center");
$timg->AddLine("center",TRUE);
$timg->AddLine("center");
$timg->MakeImage(0,0);

$timg->SetTextColor(100,255,155);
$timg->SetPos("right","center","center");
$timg->AddLine("center",TRUE);
$timg->AddLine("right");
$timg->MakeImage(0,0);

$timg->SetTextColor(0,0,0);
$timg->SetPos("left","bottom","center");
$timg->AddLine("bottom",TRUE);
$timg->AddLine("left");
$timg->MakeImage(0,0);

$timg->SetTextColor(100,100,100);
$timg->SetPos("center","bottom","center");
$timg->AddLine("bottom",TRUE);
$timg->AddLine("center");
$timg->MakeImage(0,0);

$timg->SetTextColor(255,150,50);
$timg->SetPos("right","bottom","center");
$timg->AddLine("bottom",TRUE);
$timg->AddLine("right");
$timg->SetBorder(0,0,155);
$timg->MakeImage(0,0);

$timg->ShowGif();
?>