function imageSWF()
 {
     /* parse arguments */
     $numargs = func_num_args();
     $image = func_get_arg(0);
     $swfname = "";
     if ($numargs > 1) {
         $swfname = func_get_arg(1);
     }
     /* image must be in jpeg and
        convert jpeg to SWFBitmap
        can be done by buffering it */
     ob_start();
     imagejpeg($image);
     $buffimg = ob_get_contents();
     ob_end_clean();
     $img = new SWFBitmap($buffimg);
     $w = $img->getWidth();
     $h = $img->getHeight();
     $movie = new SWFMovie();
     $movie->setDimension($w, $h);
     $movie->add($img);
     if ($swfname) {
         $movie->save($swfname);
     } else {
         $movie->output;
     }
 }
Example #2
0
#!/usr/bin/php -c.
<?php 
$m = new SWFMovie(7);
/* SWF_SETBACKGROUNDCOLOR */
$m->setBackground(0xff, 0xff, 0xff);
/* SWF_SHOWFRAME */
$m->nextFrame();
/* end of frame 1 */
/* SWF_END */
$m->save("test05.swf");
Example #3
0
#!/usr/bin/php -c.
<?php 
$m = new SWFMovie();
/* SWF_SETBACKGROUNDCOLOR */
$m->setBackground(0xff, 0xff, 0xff);
/* SWF_DEFINESPRITE */
/*  MovieClip 1 */
$character1 = new SWFMovieClip();
/* 1 frames */
/* SWF_SHOWFRAME */
$character1->nextFrame();
/* end of clip frame 1 */
/* SWF_END */
/* SWF_PLACEOBJECT2 */
/* PlaceFlagHasCharacter */
$m->add($character1);
/* PlaceFlagHasMatrix */
/* outputSWF_MATRIX is broken, so it is being skipped.. */
/* SWF_SHOWFRAME */
$m->nextFrame();
/* end of frame 1 */
/* SWF_END */
$m->save("test02.swf");
Example #4
0
#!/usr/bin/php -c.
<?php 
$m = new SWFMovie(6);
/* SWF_SETBACKGROUNDCOLOR */
$m->setBackground(0xff, 0xff, 0xff);
/* SWF_SHOWFRAME */
$m->nextFrame();
/* end of frame 1 */
/* SWF_END */
$m->save("test04.swf");
Example #5
0
#!/usr/bin/php -c.
<?php 
$m = new SWFMovie(8);
$m->setBackground(0, 0, 0);
$m->save("test07.swf");
Example #6
0
<?php

include_once '../init_constants.php';
// this can stay since it's only called via web
ming_useswfversion(6);
$parts = explode('/', $_SERVER['REDIRECT_URL']);
$swf = $parts[count($parts) - 1];
$swfBase = basename($swf, '.swf');
$swfParts = explode('_', $swfBase);
$height = array_pop($swfParts);
$width = array_pop($swfParts);
$m = new SWFMovie();
$m->setDimension($width, $height);
$m->setrate(30);
$m->add(new SWFAction('this.createEmptyMovieClip("container_mc", 1);'));
$m->add(new SWFAction('__d = new Date();'));
$m->add(new SWFAction('loadMovie("http://' . FF_SERVER_NAME . '/swf/slideshow/slide_show_prototype.swf?__dynTS="+__d.getTime(),"container_mc");'));
$m->setBackground(0, 0, 0);
$m->save($finalPath = PATH_HOMEROOT . PATH_SWF . '/container/dynamic/' . $swf);
echo $finalPath . ' was created.  <a href="javascript:history.go(-1);">Go back</a>.';
Example #7
0
#!/usr/bin/php -c.
<?php 
$m = new SWFMovie(8);
$m->save("test06.swf");
Example #8
0
<?php 
$m = new SWFMovie(8);
ming_setscale(1.0);
/*Unknown block type 69*/
/* SWF_DEFINESHAPE3 */
/* Shape 1 (TYPE=3, RECT=0,0 0,0)*/
$character1 = new SWFShape();
/*2 fillstyle(s)*/
$character1_f0_red = 0x20;
$character1_f0_green = 0x40;
$character1_f0_blue = 0x80;
$character1_f0_alpha = 0xdf;
$character1_f0 = $character1->addSolidFill($character1_f0_red, $character1_f0_green, $character1_f0_blue, $character1_f0_alpha);
/*SWFFILL_SOLID*/
$character1_f1_red = 0x40;
$character1_f1_green = 0x80;
$character1_f1_blue = 0x20;
$character1_f1_alpha = 0x18;
$character1_f1 = $character1->addSolidFill($character1_f1_red, $character1_f1_green, $character1_f1_blue, $character1_f1_alpha);
/*SWFFILL_SOLID*/
/*0 linestyles(s)*/
/* SWF_PLACEOBJECT2 */
$i1 = $m->add($character1);
$i1->setDepth(1);
/* PlaceFlagHasMatrix */
/* SWF_SHOWFRAME */
$m->nextFrame();
/* end of frame 1 */
/* SWF_END */
$m->save("test01.swf");
Example #9
0
#!/usr/bin/php -c.
<?php 
$m = new SWFMovie();
/* SWF_SETBACKGROUNDCOLOR */
$m->setBackground(0xff, 0xff, 0xff);
/* SWF_SHOWFRAME */
$m->nextFrame();
/* end of frame 1 */
/* SWF_END */
$m->save("test03.swf");
Example #10
0
#!/usr/bin/php
<?php 
$m = new SWFMovie(8);
$shape = new SWFShape();
$gradient = new SWFGradient();
$gradient->addEntry(0, 255, 0, 0, 255);
$gradient->addEntry(0.25, 0x80, 0x20, 0x20, 0xff);
$gradient->addEntry(0.8, 0x40, 0x40, 0x40, 0xff);
$fill = $shape->addGradientFill($gradient, SWFFILL_LINEAR_GRADIENT);
#$fill->moveTo(-163, -163); # this is added by swftoscript, but is wrong
$shape->setLine(1, 0, 0, 0, 255);
$shape->setRightFill($fill);
$shape->drawLine(100, 0);
$shape->drawLine(0, 100);
$shape->drawLine(-100, 0);
$shape->drawLine(0, -100);
$m->add($shape);
$m->save("test08.swf");