<?php
class snapIT {
var $filename;
var $filedir;
var $type;
var $width;
var $height;
var $border;
var $align;
var $alt;
var $ext = array( "image/jpeg" => ".jpg",
"image/pjpeg" => ".jpg",
"image/gif" => ".gif",
"image/png" => ".png",
"application/x-shockwave-flash" => ".swf",
"application/pdf" => ".pdf",
"application/zip" => ".zip",
"application/x-zip-compressed" => ".zip",
"application/msword" => ".doc"
);
function SetFile($f) {
$this->filename = $f.$this->ext[$this->type];
}
function SetDir($d) {
$this->filedir = $d;
}
function SetType($t) {
$this->type = $t;
}
function SetWidth($w) {
$this->width = $w;
}
function SetHeight($h) {
$this->height = $h;
}
function SetBorder($b) {
$this->border = $b;
}
function SetAlign($a) {
$this->align = $a;
}
function SetAlt($l) {
$this->alt = $l;
}
function SetAll($f,$d,$t,$w,$h,$b,$a = "",$l = "") {
$this->filename = $f.$this->ext[$t];
$this->filedir = $d;
$this->type = $t;
$this->width = $w;
$this->height = $h;
$this->border = $b;
$this->align = $a;
$this->alt = $l;
}
function Show() {
if(preg_match("/image/i",$this->type) && file_exists($this->filedir.$this->filename)) {
echo "<img src=\"".$this->filedir.$this->filename."\" ";
if($this->alt) echo "alt=\"".$this->alt."\" ";
if($this->width) echo "width=\"".$this->width."\" ";
if($this->height) echo "height=\"".$this->height."\" ";
if(($this->border)>(-1)) echo "border=\"".$this->border."\" ";
if($this->align) echo "align=\"".$this->align."\" ";
echo ">";
}
if($this->type=="application/x-shockwave-flash" && file_exists($this->filedir.$this->filename)) echo "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0\" width=\"$width\" height=\"$height\"><param name=movie value=\"".$this->filedir.$this->filename."\"><param name=quality value=high><embed src=\"".$this->filedir.$this->filename."\" quality=high pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\" type=\"application/x-shockwave-flash\" width=\"$width\" height=\"$height\"></embed></object>";
}
}
?> |