Code: Select all
$strAction="getURL('here should be link', '_self','SWFBUTTON_MOUSEUP');";Moderator: General Moderators
Code: Select all
$strAction="getURL('here should be link', '_self','SWFBUTTON_MOUSEUP');";Code: Select all
// jpg slideshow 2.0 : grab jpgs from specified directories and create a swf slideshow...
// code by gazb : gazb dot ming at NOSPAM gmail dot com
// http://www16.brinkster.com/gazb/ming/
// October 2003 version 1
// December 2003 version 2
// just put the directories with the jpgs here and compile
$pathtojpgs= array();
$pathtojpgs[0]= "../uploadedfiles/banner/" . $Sifra_apartmana . "/";
// some typical movie variables
Ming_setScale(20.00000000);
ming_useswfversion(6);
$movie=new SWFMovie();
$movie->setBackground(255,255,255);
$movie->setRate(40);
$movie->setDimension($w,$h);
// easing functions based on those at robertpenner.com
function easeInQuad ($t, $b, $c, $d) {
$t/=$d;
return $c*$t*$t + $b;
};
function easeOutQuad ($t, $b, $c, $d) {
$t/=$d;
return -$c *($t)*($t-2) + $b;
};
// HERE SHOULD CAME LINK THAT IS INSERTED ON EVERY FRAME
//$strAction="getURL('http://www.croatia-tourist.biz/stranice/pregled_smjestaja.php?smjestaj=" . $Sifra_apartmana . "', '_self','SWFBUTTON_MOUSEUP');";
//
$movie->add(new SWFAction($strAction));
// grab the jpgs
$f = array();
for($i=0;$i<count($pathtojpgs);$i++){
$f[$i] = array();
if ($handle = opendir($pathtojpgs[$i])) {
while (false !== ($file = readdir($handle))) {
$tmp = explode(".",$file);
if($tmp[1]=="jpg"){
array_push ($f[$i],$pathtojpgs[$i] . $file);
}
if($tmp[1]=="jpeg"){
array_push ($f[$i],$pathtojpgs[$i] . $file);
}
}
}
}
closedir($handle);
///////////////slideshow patch start//////////////////////////////
// sort the jpgs into 'natural' order using natsort //
// (eg 1.jpg,a.jpg,b1.jpg,b2.jpg,b10.jpg,b12.jpg,b100.jpg) //
// see http://www.php.net Array docs for alts to natsort //
for($i=0;$i<count($f);$i++){ //
// echo "original order\n"; //
// print_r($f[0]); //
//
natsort($f[$i]); // sort that array //
$tmp=implode(",",$f[$i]); // ugly... //
$f[$i]=explode(",",$tmp); // but it works //
//
// echo "new order\n"; //
// print_r($f[0]); //
} //
///////////////slideshow patch end////////////////////////////////
// add the jpgs to the movie with basic fade in/out
$movie->nextFrame();
for($i=0;$i<count($f);$i++){
for($k=0;$k<count($f[$i]);$k++){
$img = new SWFBitmap(fopen($f[$i][$k],"rb"));
$pic=$movie->add($img);
$sirina=$img->getwidth($img);
$visina=$img->getheight($img);
$pozicija_w = (($w - $sirina)/2);
$pozicija_h = (($h - $visina)/2);
$pic->moveTo( ($pozicija_w),($pozicija_h));
$transition=25;
$cnt=1; $startpos=0; $offset=1; $duration=$transition;
while($cnt<=$duration){
$inc=easeInQuad ($cnt++, $startpos, $offset, $duration);
$pic->multColor(1,1,1,$inc);
$movie->nextFrame();
}
for($j=1;$j<=$transition*2;$j++){
$movie->nextFrame();
}
$cnt=1; $startpos=1; $offset=-1; $duration=$transition;
while($cnt<=$duration){
$inc=easeOutQuad ($cnt++, $startpos, $offset, $duration);
$pic->multColor(1,1,1,$inc);
$movie->nextFrame();
}
$movie->remove($pic);
}
}
$movie->nextFrame();
$film=$Photo_Dir . $userID . $Sifra_apartmana . ".swf";
if($movie->save($film,9))