You could use php-gd, like so:

[code]<?php
// Set the content-type
//header("Content-type: image/png");

$sText = isset($_GET["text"])?$_GET["text"]:"asdf";
$sFileName = isset($_GET["file"])?$_GET["file"]:("style/txtimg_".
$sText.".png");
$iSize = isset($_GET["size"])?intVal($_GET["size"]):20;

if (!file_exists($sFileName)) {
        $oFont = "Superplanet.ttf";
        $iFsize = $iSize;
        $iX = 1;
        $iY = $iFsize+2;
        $iW = 120;
        $iH = 44;

        // create test to find size
        $oTestImg = imagecreatetruecolor(1, 1);
        $cBg =  imagecolorallocate($oTestImg, 0,0,0);
        $cFg =  imagecolorallocate($oTestImg, 255, 255, 255);
        imagefill($oTestImg, 0, 0, $cBg);
        $aPoints = imagettftext($oTestImg, $iFsize, 0, $iX, $iY, $cFg,
$oFont, $sText);
        imagedestroy($oTestImg);
        $iW = $aPoints[2]+1;

        // img
        $oImg = imagecreatetruecolor($iW, $iH);
        imagesavealpha($oImg, true);

        $cTrans =       imagecolorallocatealpha($oImg, 255, 255, 255, 127);
        $cRed =         imagecolorallocate($oImg, 182,13,62);
        $cWhite =       imagecolorallocate($oImg, 227,215,198);
        $cBlack =       imagecolorallocate($oImg, 0,0,0);
        imagefill($oImg, 0, 0, $cTrans);

        $aPos = array(array(-1,-1),array(1,-1),array(-1,1),array(1,1));

        // normal
        foreach ($aPos as $aPs) imagettftext($oImg, $iFsize, 0, $iX+$aPs[0],
$iY+$aPs[1], $cWhite, $oFont, $sText);
        imagettftext($oImg, $iFsize, 0, $iX, $iY, $cRed, $oFont, $sText);

        // hoover
        foreach ($aPos as $aPs) imagettftext($oImg, $iFsize, 0, $iX+$aPs[0],
$iH/2+$iY+$aPs[1], $cRed, $oFont, $sText);
        imagettftext($oImg, $iFsize, 0, $iX, $iH/2+$iY, $cWhite, $oFont,
$sText);

//      $sPos = $aPoints[0]."/".$aPoints[1]."  ".$aPoints[2]."/".$aPoints
[3];
//      imagettftext($oImg, 16, 0, $iX, $iH/2+$iY, $cBlack, $oFont, $sPos);
//      echo $sFileName;
        imagealphablending( $oImg, true );
        imagepng($oImg, $sFileName);
        imagedestroy($oImg);
}
list($iW) = getimagesize( $sFileName );// [, array &$imageinfo ] )
echo $iW;
//imagepng($oImg);
//imagedestroy($oImg);
?>[/code]

cheriana wrote:
> Hi - I am developing a site in joomla using the superfish drop down
> menu and would like to be able to replace the main menu links (not the
> drop downs) with a true type font. I know there are many joomla sifr
> plugins, but none of them seem to be compatible with the superfish
> menu. If I can't integrate superfish with sifr, is it possible to make
> the links images instead? Here's the site I'm working on:
> http://projects.thatsus.com/angelinascms/
>
> Thanks!

Reply via email to