Graphics Php

If ($Submit<>"Next ->")
{
?>

Upload pictures





Picture index















































  picture
#1

#2

#3

#4

#5

#6

#7

#8

#9

#10 













}
else
{
// Define Back string
$back = <<




EOD;
// End Define Back string
flush();
set_time_limit(0);
$piccount=0;
if (!(extension_loaded("gd")))
{echo "GD library not compiled or loaded into this server!

This script can not work without GD library!";
die;
}
if (!(extension_loaded("ming")))
{echo "MING library not compiled or loaded into this server!

This script can not work without MING library!";
die;
}
if (!(is_dir("data")))
{echo "Directory \"data\" not found!

Please create directory with name \"data\" and set 0777 permissions
(uploaded files goes here)";
die;
}
if ($insid=="")
{
echo "Missing picture index".$back;
die;
}
// MAIN LOOP
for ($i=1;$i<11;$i++)
{
// execute code only for selected/browsed files
$xpic="pic".$i;
if (($$xpic<>"none") and ($$xpic<>""))
{
//file type check
$cert1 = "image/pjpeg"; //jpg
$cert2 = "image/jpeg"; //jpg (for MAC)
$xtype =$HTTP_POST_FILES[$xpic]['type'];
if (($xtype <> $cert1) AND ($xtype <> $cert2))
{$log.= "#$i Not allowed file type ! ($xtype)
";}
else
{
//copy jpg pic to server
$dest="data/pic".$insid."_".$i."big.jpg";
If (move_uploaded_file($$xpic, $dest))
{$log.=""; $piccount+=1;}
else
{$log.="$dest upload error!($$xpic)
";}
// create SWF pic using MING lib functions
$jpgx="data/pic".$insid."_".$i."big.jpg";
$b = new SWFBitmap($jpgx); //### create new FLASH bitmap object
$pic = new SWFShape(); //### create new FLASH shape object
$pic->setRightFill($pic->addFill($b));
$pic->drawLine($b->getWidth(), 0);
$pic->drawLine(0, $b->getHeight());
$pic->drawLine(-$b->getWidth(), 0);
$pic->drawLine(0, -$b->getHeight());
$big_h=$b->getHeight(); //### get uploaded pic heigh (for create jpg thumb)
$big_w=$b->getWidth(); //### get uploaded pic with (for create jpg thumb)
$movie = new SWFMovie();
$movie->setRate(50); //### Set movie frame rate
//### set movie dimension as JPG dimension
$movie->setDimension($b->getWidth(), $b->getHeight());
$movie->setBackground(0xff, 0xff, 0xff);
$movie->add($pic); //### Add created shape object to curent frame
$movie->nextFrame();
$swfx="data/pic".$insid."_".$i."big.swf";
$movie->save ($swfx); //### save this movi to hard/server
chmod ($swfx, 0755); //### Change file permision
$log.="#$i SWF pic created ($swfx)
";
// end create SWF pic
// make thumbnail from uploaded pic using GD2 lib functions
$scale_ratio=0.5; //### Thumbnail scale ratio
$quality=90; //### Thumbnail quality
$dest_w=$big_w*$scale_ratio;
$dest_h=$big_h*$scale_ratio;
$src_w=$big_w;
$src_h=$big_h;
$dest_jpgx="data/pic".$insid."_".$i."big.jpg";
$dest_t="data/pic".$insid."_".$i."thumb.jpg";
$in_jpg = imagecreatefromjpeg($dest_jpgx);
$out_jpg = imagecreatetruecolor($dest_w,$dest_h);
imagecopyresampled($out_jpg,$in_jpg,0,0,0,0,$dest_w,$dest_h,$src_w,$src_h);
imagejpeg($out_jpg,$dest_t,$quality); //### save this thumb to hard/server
imagedestroy($in_jpg);
imagedestroy($out_jpg);
// end make thumb from uploaded pic
// create SWF thumb using MING lib function
$jpgx1="data/pic".$insid."_".$i."thumb.jpg";
$b = new SWFBitmap($jpgx1); //### create new FLASH bitmap object
$pic = new SWFShape(); //### create new FLASH shape object
$pic->setRightFill($pic->addFill($b));
$pic->drawLine($b->getWidth(), 0);
$pic->drawLine(0, $b->getHeight());
$pic->drawLine(-$b->getWidth(), 0);
$pic->drawLine(0, -$b->getHeight());
$movie = new SWFMovie();
$movie->setRate(50); //### Set movie frame rate
//### set movie dimension as JPG dimension
$movie->setDimension($b->getWidth(), $b->getHeight());
$movie->setBackground(0xff, 0xff, 0xff);
$movie->add($pic); //### Add created shape object to curent frame
$movie->nextFrame();
$swfx="data/pic".$insid."_".$i."thumb.swf";
$movie->save ($swfx); //### save this movi to hard/server
chmod ($swfx, 0755); //### Change file permision
$log.="#$i SWF thumb created ($swfx)
";
// end create SWF thumb
} //### end type check
} //### end selected/browsed files
} //### end MAIN LOOP
echo $log."
";
echo "Number of updated picures: ".$piccount."
";
echo $back;
} //### end submit
?>