Dan
Member
  
221 Posts
Location . Sheffield, UK Status: Offline
|
posted on 6.22.2002 at 11:42 |
|
|
testing
Testing these avatars - they're just crappy little icons for testing, but should be random each page load.
|
|
|
Dan
Member
  
221 Posts
Location . Sheffield, UK Status: Offline
|
posted on 6.22.2002 at 11:48 |
|
|
heh .. works.
Had to trick the message board, by renaming my PHP script .jpg and then using a .htaccess file to make my server process .jpg files as .php files.
|
-- no sig --
|
|
|
hzr
|
posted on 6.22.2002 at 11:51 |
|
|
ha, cool Dan
|
hzr
|
|
|
jimdrake
|
posted on 6.22.2002 at 11:53 |
|
|
cool.
what does the php/jpg file look like then?
|
|
|
|
Dan
Member
  
221 Posts
Location . Sheffield, UK Status: Offline
|
posted on 6.22.2002 at 11:58 |
|
|
Not complex at all:
code: <?
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
$r = rand(1,4);
header("Content-type: image/gif");
$fn=fopen("./sig" . $r . ".gif","r");
fpassthru($fn);
?>
Now i'm going to do some experinting with randomly generated images.
|
-- no sig --
|
|
|
anders
|
posted on 6.22.2002 at 11:59 |
|
|
dan, u r amazing...
i was just trying to find a script like that to use for my avatars and sigs too...lol.....
wanted to use a script that would show random sigs but without having to turn on html....
you are a genius...
|
"Life is not measured by the number of breaths we take, but the moments that take our breath away."
|
|
|
Dan
Member
  
221 Posts
Location . Sheffield, UK Status: Offline
|
posted on 6.22.2002 at 12:09 |
|
|
Heh ... thx anders.
btw it's nothing special.
[Edited on 22.6.2002 by Dan]
|
-- no sig --
|
|
|
Dan
Member
  
221 Posts
Location . Sheffield, UK Status: Offline
|
posted on 6.22.2002 at 14:07 |
|
|
My avatar now has random sentences... they don't make much sence and I could do with adding more words to it.
The code if anyone's interested:
code: function ImageStringWrap($image, $font, $x, $y, $text, $color, $maxwidth) {
$fontwidth = ImageFontWidth($font);
$fontheight = ImageFontHeight($font);
if ($maxwidth != NULL) {
$maxcharsperline = floor($maxwidth / $fontwidth);
$text = wordwrap($text, $maxcharsperline, "\n", 1);
}
$lines = explode("\n", $text);
while (list($numl, $line) = each($lines)) {
ImageString($image, $font, $x, $y, $line, $color);
$y += $fontheight;
}
}
$Xart = array("the","a","another");
$Xv = array("throw","like","kiss","hit","love","hate","hug");
$Xn = array("car","dog","tree","bush","tennis ball","design", "website","man","woman");
$Xobj = array("anders","sher","alex","sergi","david","dan","simu","shane","janny","jmax","jooli","ttrenka","maik.l","hzr","claudia","webster","jay","chris","syedur","bobman","rem","jimdrake","pixelkitty","madis","abhi");
$Xadj = array("blue","black","dark","light","funny","cool","white","grey","badass","crap","furry","fast","slow","beautiful","ugly");
$Xaux = array("can","will","should");
$Xnp[0] = array(" ","Xart"," ","Xn");
$Xnp[1] = array(" ","Xart"," ","Xadj"," ","Xn");
$Xnp[2] = array(" ","Xobj");
$Xvp[0] = array(" ",'Xv','s','Xnp');
$Xvp[1] = array(" ",'Xaux'," ",'Xv','Xnp');
//$vp[2] = array('Xv');
$Xs[0] = array('Xnp','Xvp');
function process($item) {
global $Xart, $Xadj, $Xv, $Xn, $Xobj, $Xnp, $Xvp, $Xs, $Xaux;
$out = "";
if(is_array($item)) {
$i = rand(0,count($item)-1);
if(is_string($item[0])) $out = $item[$i];
else foreach($item[$i] as $sub)
if(is_array($$sub)) $out .= process($$sub);
else $out .= $sub;
} else $out = $item;
return $out;
}
$str = trim(process($Xs));
header("Content-type: image/gif");
$im = imagecreate(139,50);
$background_color = imagecolorallocate($im,230,230,230);
$text_color = imagecolorallocate($im,50,50,50);
ImageStringWrap($im, 2, 5, 0, "$str", $text_color, 129);
imagepng($im);
|
-- no sig --
|
|
|
hzr
|
posted on 6.22.2002 at 16:21 |
|
|
Very cool Dan
|
hzr
|
|
|
Sergi
|
posted on 6.22.2002 at 16:57 |
|
|
hehe, found an error... and i provide the answer, all in one...
please add the following line just after the trim sentence:
$str=eregi_replace("sss","sses",$str);
Otherwise you endup with things like kisss
ciao
|
Sergi: [ meddle v2 ] || [ gen7es ] || [ e ]
|
|
|
Sergi
|
posted on 6.22.2002 at 16:58 |
|
|
|
|
Sergi
|
posted on 6.22.2002 at 17:01 |
|
|
|
|
hzr
|
posted on 6.22.2002 at 18:00 |
|
|
Hehe, it's far to the right because of Dan's code. Scroll and you will see the button.
|
hzr
|
|
|
hzr
|
posted on 6.22.2002 at 18:04 |
|
|
also noticed that it can be like "...a ugly..." when it should be "...an ugly..."
btw, got these:
"a light website hates pixelkitty" and
"a gray woman will throw dan" hehe
[Edited on 22.6.2002 by HZR]
|
hzr
|
|
|
whatisthematrix
|
posted on 6.22.2002 at 18:19 |
|
|
very nice work dan!!
but my forum size flip out at this thread...
|
I'm whatever I want, you can like it or love it // [loading]
|
|
|
hzr
|
posted on 6.22.2002 at 18:22 |
|
|
It's because of the code lines, they don't have line breaks.
And Jooli, I will hug you:
"hzr will hug jooli"
[Edited on 22.6.2002 by HZR]
|
hzr
|
|
|
whatisthematrix
|
posted on 6.22.2002 at 18:38 |
|
|
what...hug jooli??
|
I'm whatever I want, you can like it or love it // [loading]
|
|
|
Dan
Member
  
221 Posts
Location . Sheffield, UK Status: Offline
|
posted on 6.22.2002 at 18:57 |
|
|
Thanks for the syntax fixes. Not done them as there are actually loads. Since it is only a simple vocabulary I thought I'd leave it as it is, to avoid spending untold hours making it do longer more sensicle sentences. Plus I don't want to delve in to deply into my "Natural Language Processing" notes, gives me nightmares
If your interested the 6 rules are:
Sentence = Noun Phrase + Verb Phrase
Noun Phrase = Article + Noun
Noun Phrase = Article + Adjective + Noun
Noun Phrase = Object
Verb Phrase = Verb + "s" + Noun Phrase
Verb Phrase = Verb + Auxilary + Noun Phrase
|
-- no sig --
|
|
|
Sergi
|
posted on 6.22.2002 at 19:29 |
|
|
|
|
jimdrake
|
posted on 6.23.2002 at 10:19 |
|
|
hmm, i got 'pixelkitty throws pixelkitty'
|
|
|
|
rem_sr
|
posted on 6.23.2002 at 15:21 |
|
|
really nice one dan... I really like it, I started to play with it, by refreshing and these is what I came up with...
- a cool man should like abhi
- a car hits another white tennis ball (every1 knows that tennisball should be yellow-colored)
- another tree hits chris (watch out chris, don't go near trees, they are mad at you...
)
- jay should throw anders
- anders hits the badass tennis ball
- another funny woman hits a ugly website
- another black tennis ball should kiss pixelkitty
- the grey design throws janny (hmmm.. thought it was Janny that throws design/graphics etc. instead of reverse...
)
- a blue man likes jooli (a blue man?? who could that be? HZR are you blue??
)
it's been really fun...
|
s a m [ u e l ]
Dissatisfaction is the mother of development
|
|
|
hzr
|
posted on 6.23.2002 at 15:30 |
|
|
No I'm not blue (but I like Jooli hehe (whoops, I was blue))
anders is green though (well, on his earlier avatar he was).
[Edited on 23.6.2002 by HZR]
|
hzr
|
|
|
Alex
Member
  
271 Posts
Status: Offline
|
posted on 6.23.2002 at 18:05 |
|
|
the woman can hug a design
nice job!
|
|
|
Dan
Member
  
221 Posts
Location . Sheffield, UK Status: Offline
|
posted on 6.23.2002 at 18:26 |
|
|
Yeah, not many of them seem to make much sense.
Just got though:
"Pixelkitty should kiss the blue woman"
|
-- no sig --
|
|
|
Dan
Member
  
221 Posts
Location . Sheffield, UK Status: Offline
|
posted on 6.23.2002 at 18:27 |
|
|
oh and:
"another black car hits the dog"
which is quite amusing
|
-- no sig --
|
|
|