note 90103 added to class.swfmovie
| From: | markomohundro at osu1 dot php dot net | Date: | Mon, 06 Apr 2009 15:47:53 +0000 |
| Subject: | note 90103 added to class.swfmovie | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-152863@lists.php.net to get a copy of this message | ||
<?php
// php ming 'challenge response' style text to graphics routine --
// (example only; any use for input validation is up to you, however
// this image can be displayed on text pages in an html iframe)
$f = new SWFFont("Bitstream Vera Serif.fdb");
$m = new SWFMovie();
$m->setDimension(500, 150);
$m->setBackground(255, 255, 255);
for ($r=0; $r < 6; $r++) {
// random char selected from range: '2-9', 'A-Z', 'a-z'
switch (rand(0,2)) {
case 0:
$c = chr(rand(50,57));
break;
case 1:
$c = chr(rand(65,90));
break;
case 2:
$c = chr(rand(97,122));
break;
}
$p = convertchar($c);
$i = $m->add($p);
}
$i->setDepth(1);
header('Content-type: application/x-shockwave-flash');
$m->output();
?>
<?php
function convertchar($txt) {
global $f;
static $x=10, $y=5;
$s = new SWFShape();
$s->setLine(rand(0,1),125,125,200); // (line weight, r, g, b)
$s->drawLine(rand(15,25),0);
$t = new SWFText();
$t->setFont($f);
$t->setColor(15, 15, 195);
$t->setHeight(40);
$t->addString($txt);
$p = new SWFSprite();
$is = $p->add($s);
$it = $p->add($t);
$is->move($x,$y); // lines thru char
$it->move($x,$y+8);
$x+=75;
// all chars adjusted in a slightly random manner
$rs = rand(-1,1);
for ($n=0; $n < 3; $n++) {
$it->scaleTo($n, 1);
$is->scaleTo($n, 1);
$it->rotate($rs);
$is->rotate($rs);
$it->skewx(-$rs/10);
$is->skewx(-$rs/10);
$it->skewy($rs/10);
$is->skewy($rs/10);
$p->nextframe();
}
$p->add(new SWFAction("stop();"));
$p->nextFrame();
return $p;
}
?>
----
Server IP: 69.147.83.197
Probable Submitter: 75.38.21.252
----
Manual Page -- http://www.php.net/manual/en/class.swfmovie.php
Edit -- https://master.php.net/note/edit/90103
Del: integrated -- https://master.php.net/note/delete/90103/integrated
Del: useless -- https://master.php.net/note/delete/90103/useless
Del: bad code -- https://master.php.net/note/delete/90103/bad+code
Del: spam -- https://master.php.net/note/delete/90103/spam
Del: non-english -- https://master.php.net/note/delete/90103/non-english
Del: in docs -- https://master.php.net/note/delete/90103/in+docs
Del: other reasons-- https://master.php.net/note/delete/90103
Reject -- https://master.php.net/note/reject/90103
Search -- https://master.php.net/manage/user-notes.php