Images = array();
}
function Add ( $ThumbImage ) {
array_push ( $this->Images , $ThumbImage );
}
function GetImages () {
return $this->Images;
}
function DrawImg ( $NumColumnas = 4 ) {
$i = 0;
$Columna = $NumColumnas - 1;
echo "
";
foreach ( $this->GetImages() as $Item ) {
if ( $i == 0 )
echo "";
echo "| ";
$Item->HTMLImgDraw();
echo " | ";
if ( $i == $Columna ) {
echo "
";
$i = 0;
}
else {
$i++;
}
}
echo "
";
}
function DrawDblClickImg ( $NumColumnas = 4 ) {
$i = 0;
$Columna = $NumColumnas - 1;
echo "";
foreach ( $this->GetImages() as $Item ) {
if ( $i == 0 )
echo "";
echo "| ";
$Item->HTMLDblClickImgDraw();
echo " | ";
if ( $i == $Columna ) {
echo "
";
$i = 0;
}
else {
$i++;
}
}
echo "
";
}
function DrawAnchor ( $NumColumnas = 4 ) {
$i = 0;
$Columna = $NumColumnas - 1;
echo "";
foreach ( $this->GetImages() as $Item ) {
if ( $i == 0 )
echo "";
echo "| ";
$Item->HTMLAnchorDraw(1);
echo " | ";
if ( $i == $Columna ) {
echo "
";
$i = 0;
}
else {
$i++;
}
}
echo "
";
}
}
class ThumbImage {
var $Width;
var $Height;
var $SrcPath;
var $DstPath;
var $Name;
var $CompleteSrcPath;
var $CompleteDstPath;
var $Thumb;
var $Alt;
function ThumbImage ( $Width , $Height , $Name , $Alt ="Imagen" , $SrcPath = "images/upload/" , $DstPath = "images/upload_p/" ) {
$this->Width = $Width;
$this->Height = $Height;
$this->Name = $Name;
$this->Alt = $Alt;
$this->SrcPath = $SrcPath;
$this->DstPath = $DstPath;
$this->CompleteSrcPath = $this->GetSrcPath() . $this->GetName();
$this->CompleteDstPath = $this->GetDstPath() . $this->GetName();
}
function SetWidth ( $Width ) {
$this->Width = $Width;
}
function GetWidth () {
return $this->Width;
}
function SetHeight ( $Height ) {
$this->Height = $Height;
}
function GetHeight () {
return $this->Height;
}
function SetSrcPath ( $SrcPath ) {
$this->SrcPath = $SrcPath;
}
function GetSrcPath () {
return $this->SrcPath;
}
function SetDstPath ( $DstPath ) {
$this->DstPath = $DstPath;
}
function GetDstPath () {
return $this->DstPath;
}
function SetName ( $Name ) {
$this->Name = $Name;
}
function GetName () {
return $this->Name;
}
function SetAlt ( $Alt ) {
$this->Alt = $Alt;
}
function GetAlt () {
return $this->Alt;
}
function GetCompleteSrcPath() {
return $this->CompleteSrcPath;
}
function GetCompleteDstPath() {
return $this->CompleteDstPath;
}
function SetProportionalSize() {
}
function Render () {
if ( ! is_file ( $this->GetCompleteDstPath() ) && is_file ( $this->GetCompleteSrcPath() ) ) {
$this->SetProportionalSize();
$imagenOriginal = imagecreatefromjpeg ( $this->GetCompleteSrcPath() );
$this->Thumb = imagecreatetruecolor( $this->GetWidth() , $this->GetHeight() );
imagecopyresized ( $this->Thumb , $imagenOriginal , 0 , 0 , 0 , 0 , $this->GetWidth() , $this->GetHeight() , imagesx ( $imagenOriginal ) , imagesy ( $imagenOriginal ) );
imagejpeg ( $this->Thumb , $this->GetCompleteDstPath() );
}
}
function HTMLImgDraw () {
if ( is_file ( $this->GetCompleteDstPath() ) )
echo "
";
}
function HTMLDblClickImgDraw () {
if ( is_file ( $this->GetCompleteDstPath() ) )
echo "
GetName() . "');\" src='" . $this->GetCompleteDstPath() . "' width='" . $this->GetWidth() . "' height='" . $this->GetHeight() . "' alt='" . $this->GetAlt() . "' />";
}
function HTMLAnchorDraw ( $NewWindow = 0 , $CssClass = "" ) {
if ( is_file ( $this->GetCompleteDstPath() ) && is_file ( $this->GetCompleteSrcPath() ) ) {
echo "";
echo "
";
}
}
}
?>