예제 #1
0
function makeImgMovie($imgFile)
{
    //Make sure this file is an actual jpg file
    if (is_file($imgFile) && ereg("\\.jpg\$", $imgFile)) {
        //Launch Flash
        $movie = new swfMovie();
        $movie->setBackground(255, 255, 255);
        //Import a bitmap
        $b = new SWFBitmap(fOpen($imgFile, "rb"));
        //Get it's width and height
        $w = $b->getWidth();
        $h = $b->getHeight();
        //Make stage as big as the width and height of our bitmap
        $movie->setDimension($w, $h);
        //Convert Bitmap to a shape for Flash.
        //This process is automated upon import in Flash, but with
        //Ming we have have to do it ourselves. I see it as more control:)
        $s = new SWFShape();
        $f = $s->addFill($b);
        $s->setRightFill($f);
        //draw corners for the bitmap shape
        $s->drawLine($w, 0);
        $s->drawLine(0, $h);
        $s->drawLine(-$w, 0);
        $s->drawLine(0, -$h);
        //CreateEmptyMovieclip
        $p = new SWFSprite();
        //add our bitmap shape to this movieclip
        $p->add($s);
        $p->nextFrame();
        //Add this movieclip to our main movie's timeline
        //Much like dragging a symbol from the library in Flash.
        $i = $movie->add($p);
        //Give this instance a name.. let's call it mImg as in movie image
        $i->setName("mImg");
        //Output the movie.. Ctrl+Enter!
        // header("Content-Type:application/x-shockwave-flash");
        $movie->output();
    }
    //End if
}
예제 #2
0
 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;
     }
 }
예제 #3
0
 public function EffectManage2($preDisp, $curDisp, $idx, $chkN)
 {
     // effect 이름을 검사하자..
     if ($this->m_szEffect[$idx] == "") {
         return;
     }
     $bitmap = new SWFBitmap($this->m_szImgPath[$idx]);
     $width = $bitmap->getWidth();
     $height = $bitmap->getHeight();
     if ($this->m_szEffect[$idx] == "fade through white") {
         if ($chkN) {
             if ($curDisp != NULL) {
                 $curDisp->scaleTo(0.01, 0.01);
             }
             $this->ImageEffect_fade_through_white_1($preDisp, $width, $height);
             if ($curDisp != NULL) {
                 $curDisp->scaleTo(1.0, 1.0);
             }
         } else {
             $this->ImageEffect_fade_through_white_2($preDisp, $width, $height);
         }
     } else {
         if ($this->m_szEffect[$idx] == "fade through black") {
             if ($chkN) {
                 if ($curDisp != NULL) {
                     $curDisp->scaleTo(0.01, 0.01);
                 }
                 $this->ImageEffect_fade_through_black_1($preDisp, $width, $height);
                 if ($curDisp != NULL) {
                     $curDisp->scaleTo(1.0, 1.0);
                 }
             } else {
                 $this->ImageEffect_fade_through_black_2($preDisp, $width, $height);
             }
         } else {
             if ($this->m_szEffect[$idx] == "cross zoom") {
                 if ($curDisp != NULL) {
                     $this->ImageEffect_cross_zoom($preDisp, $curDisp, $width, $height);
                 }
             } else {
                 if ($this->m_szEffect[$idx] == "dissolve") {
                     if ($curDisp != NULL) {
                         $this->ImageEffect_dissolve($preDisp, $curDisp, $width, $height);
                     }
                 }
             }
         }
     }
 }
예제 #4
0
<?php

$s = new SWFShape();
$fp = fopen('../../intro/php-big.jpg', 'r');
$jpg = new SWFBitmap($fp);
$w = $jpg->getWidth();
$h = $jpg->getHeight();
$f = $s->addFill($jpg);
$f->moveTo(-$w / 2, -$h / 2);
$s->setRightFill($f);
$s->movePenTo(-$w / 2, -$h / 2);
$s->drawLine($w, 0);
$s->drawLine(0, $h);
$s->drawLine(-$w, 0);
$s->drawLine(0, -$h);
$p = new SWFSprite();
$i = $p->add($s);
for ($step = 0; $step < 360; $step += 2) {
    $p->nextFrame();
    $i->rotate(-2);
}
$m = new SWFMovie();
$i = $m->add($p);
$i->moveTo(230, 120);
$m->setRate(100);
$m->setDimension($w * 1.8, $h * 1.8);
header('Content-type: application/x-shockwave-flash');
$m->output(6);
예제 #5
0
 public function EffectManage2($preDisp, $curDisp, $idx, $chkN)
 {
     // effect ̸ ˻..
     if ($this->m_szEffect[$idx] == "") {
         return;
     }
     $path = "./" . $this->m_szImgPath[$idx];
     $bitmap = new SWFBitmap(fopen($path, "rb"));
     $width = $bitmap->getWidth();
     $height = $bitmap->getHeight();
     $effectName = strtolower($this->m_szEffect[$idx]);
     if ($effectName == "fade through white") {
         if ($chkN) {
             //if( $curDisp != NULL ) $curDisp->scaleTo(0.01,0.01);
             if ($curDisp != NULL) {
                 $curDisp->moveTo(-1000, -1000);
             }
             //$curDisp->scaleTo(0.01,0.01);
             $this->ImageEffect_fade_through_white_1($preDisp, $width, $height);
             if ($curDisp != NULL) {
                 $curDisp->scaleTo(1.0, 1.0);
             }
         } else {
             $this->ImageEffect_fade_through_white_2($preDisp, $width, $height);
         }
     } else {
         if ($effectName == "fade through black") {
             if ($chkN) {
                 if ($curDisp != NULL) {
                     $curDisp->moveTo(-1000, -1000);
                 }
                 //$curDisp->scaleTo(0.01,0.01);
                 $this->ImageEffect_fade_through_black_1($preDisp, $width, $height);
                 //if( $curDisp != NULL ) $curDisp->scaleTo(1.0,1.0);
             } else {
                 $this->ImageEffect_fade_through_black_2($preDisp, $width, $height);
             }
         } else {
             if ($effectName == "cross zoom") {
                 if ($curDisp != NULL) {
                     $this->ImageEffect_cross_zoom($preDisp, $curDisp, $width, $height);
                 }
             } else {
                 if ($effectName == "dissolve") {
                     if ($curDisp != NULL) {
                         $this->ImageEffect_dissolve($preDisp, $curDisp, $width, $height);
                     }
                 }
             }
         }
     }
 }