What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » PHP help needed

PHP help needed
Author: Message:
Ezra
Veteran Member
*****

Avatar
Forgiveness is between them and God

Posts: 1960
Reputation: 31
37 / Male / Flag
Joined: Mar 2003
O.P. RE: PHP help needer
Thanks for the reply KeyStorm :), However, i'm still having trouble :(

I added your code to mine and ended up with this:

code:
<?
//Header information
header("Content-type: image/gif");

//Get the quote from the file
function randomNummer($van, $tot)
{
    srand ((double) microtime() * 1000000); // seed the generator
    $return = rand($van,$tot);
   
    return($return);
}

$textLijst = 'randomquote.txt'; // the quotes are in here, on every line a new quote..

$textArray = file($textLijst); // The lines in an array.

$textCount = count($textArray); // How many lines are there??

$randomRegelNummer = randomNummer(0, ($textCount - 1)); // the number of a line.

$textRegel = $textArray[$randomRegelNummer]; // a random line number from the file

//Variabels
//$text = $textRegel; //the actual string you want to output
$size = 4; //the size of the font
$angle = 0; //the angle of the font (0 for horizontal)
$maxlen = 290; //the maximum length that should be allowed (for 300px it's ok to set 290 in here)

// Keystorms Improvemend by slicing

$slices = explode(' ',$textRegel); 
$split = count($slices);
do{
$split--;
$out1 = NULL;
for($i=0;$i<=$split;$i++)
{
$out1 .= $slices[$i]." ";
}

$break = imagettfbbox($size,$angle,$fontpath,$out1);
} while ($break[2] > $maxlen);
$out2 = NULL;
for($j=$i; $j<count($slices); $j++)
{
$out2 .= $slices[$j].' ';
}

//Image code, edited by Keystorm

$im = imagecreate($break[2]+10,50);
$background_color = imagecolorallocate($im, 100, 100, 100);
$text_color = imagecolorallocate($im, 000, 000, 200);
imagecolortransparent($im, $background_color);
imagettftext($img,$size,$angle, 5, 15, $text_color, $font, $out1."\n\r".$out2);
imagegif($im);
imagedestroy($im);
?>

But the image doesn't get outputted, this is what I get:
http://school.tsdme.nl/randomquote/plaatje2.php

Yes, i'm a php n00b :P, and I'm trying to do things that I can't, but i'm still learning...
[Image: 1-0.png]
             
04-17-2005 07:32 PM
Profile PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
PHP help needed - by Ezra on 04-17-2005 at 05:22 PM
RE: PHP help needer - by KeyStorm on 04-17-2005 at 05:53 PM
RE: PHP help needer - by Ezra on 04-17-2005 at 07:32 PM
RE: PHP help needed - by KeyStorm on 04-17-2005 at 08:56 PM
RE: PHP help needed - by Ezra on 04-17-2005 at 09:25 PM
RE: PHP help needed - by KeyStorm on 04-17-2005 at 09:42 PM
RE: PHP help needed - by Ezra on 04-17-2005 at 09:47 PM
RE: PHP help needed - by KeyStorm on 04-17-2005 at 09:54 PM
RE: PHP help needed - by Ezra on 04-18-2005 at 12:07 PM
RE: PHP help needed - by KeyStorm on 04-18-2005 at 12:56 PM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On