Zufallsbilder der 4images Galeriein Contenido einbinden
Funktionen:
Eine oder mehrere Kategorieen
Link auf Orginalbild in der Galerie
INPUT:
Code: Alles auswählen
?><?php
/***********************************************
* CONTENIDO MODUL - INPUT
*
* Modulname : 4images Schnittstelle
* Author(s) : Markus Grampp
* Copyright : DJ W. Event- & IT-Service
* Created : 30.01.2006
************************************************/
?>
<table border="0">
<tr>
<td><?php echo mi18n("Kategorieen der Galerie");?></td>
<td><input type="text" name="<?php echo "CMS_VAR[0]";?>" value="<?php echo "CMS_VALUE[0]"; ?>"></td>
</tr>
<tr>
<td><?php echo mi18n("Rooth Path der Galerie");?></td>
<td><input type="text" name="<?php echo "CMS_VAR[1]";?>" value="<?php echo "CMS_VALUE[1]"; ?>"></td>
</tr>
<tr>
<td><?php echo mi18n("Url der Galerie");?></td>
<td><input type="text" name="<?php echo "CMS_VAR[2]";?>" value="<?php echo "CMS_VALUE[2]"; ?>"></td>
</tr>
</table>
<?php
Code: Alles auswählen
<?php
/***********************************************
* CONTENIDO MODUL - INPUT
*
* Modulname : 4images Schnittstelle
* Author(s) : Markus Grampp
* Copyright : DJ W. Event- & IT-Service
* Created : 30.01.2006
************************************************/
$CategoriesView="CMS_VALUE[0]";
$MakePicturesArray[ROOT_PATH] = "CMS_VALUE[1]";
$MakePicturesArray[SCRIPT_URL] = "CMS_VALUE[2]";
if ($CategoriesView !="" && $MakePicturesArray[SCRIPT_URL]!="" && $MakePicturesArray[SCRIPT_URL]!="" ) {
$CatArray = explode(",", $CategoriesView);
$MakePicturesArray[CatArray] = $CatArray;
if (function_exists(MakePictures) == false) {
function MakePictures($MakePicturesArray){
// PATH to your 4images Gallery / PFAD zu Ihrer 4images Gallerie
if (count($MakePicturesArray[CatArray]) <= 0) {
$OutArray[PicFullView]= "";
$OutArray[PicThumbView]= "";
$OutArray[PicName]= "";
$OutArray[PicComments]= "";
return $OutArray;
}
define('ROOT_PATH', $MakePicturesArray[ROOT_PATH]);
foreach ($MakePicturesArray[CatArray] as $Cat) {
if ($CatSQLCode!="") {
$CatSQLCode .= " OR a.cat_id=".$Cat;
} else {
$CatSQLCode .= " a.cat_id=".$Cat;
}
}
if ($CatSQLCode!="") {
$CatSQLCode="AND (".$CatSQLCode.")";
}
include(ROOT_PATH.'config.php');
include(ROOT_PATH.'includes/db_mysql.php');
include(ROOT_PATH.'includes/constants.php');
$site_db = new Db($db_host, $db_user, $db_password, $db_name);
if (!function_exists(is_remote)) {
function is_remote($file_name) {
return (preg_match('#^https?\\:\\/\\/[a-z0-9\-]+\.([a-z0-9\-]+\.)?[a-z]+#i', $file_name)) ? 1 : 0;
}
}
$sql = "SELECT COUNT(*) as total_images
FROM ".IMAGES_TABLE." a, ".CATEGORIES_TABLE." b
WHERE a.image_active=1
AND a.cat_id = b.cat_id
AND b.auth_viewcat=".AUTH_ALL."
AND b.auth_viewimage=".AUTH_ALL."
".$CatSQLCode."
";
$row = $site_db->query_firstrow($sql);
$total_images = $row['total_images'];
mt_srand((double)microtime() * 1000000);
$number = ($total_images > 1) ? mt_rand(0, $total_images - 1) : 0;
$sql = "SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_media_file, a.image_thumb_file, a.image_comments
FROM ".IMAGES_TABLE." a, ".CATEGORIES_TABLE." b
WHERE a.image_active=1
AND a.cat_id = b.cat_id
AND b.auth_viewcat=".AUTH_ALL."
AND b.auth_viewimage=".AUTH_ALL."
".$CatSQLCode."
LIMIT $number, 1";
$row = $site_db->query_firstrow($sql);
$image_id = $row['image_id'];
$cat_id = $row['cat_id'];
$image_name = $row['image_name'];
$image_comments = $row['image_comments'];
$thumb_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : $MakePicturesArray[SCRIPT_URL].THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];
$media_src = (is_remote($row['image_media_file'])) ? $row['image_media_file'] : $MakePicturesArray[SCRIPT_URL].MEDIA_DIR."/".$cat_id."/".$row['image_media_file'];
if ($image_id) {
$OutArray[PicThumbView]= "<a href=\"".$MakePicturesArray[SCRIPT_URL]."details.php?image_id=$image_id\" target=\"_blank\"><img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\"></a><br>\n";
$OutArray[PicFullView]= "<a href=\"".$MakePicturesArray[SCRIPT_URL]."details.php?image_id=$image_id\" target=\"_blank\"><img src=\"".$media_src."\" border=\"0\" alt=\"$image_name\"></a><br>\n";
$OutArray[PicName]= "<b>$image_name</b><br>\n";
$OutArray[PicComments]= "Comments: $image_comments<br>\n";
} else {
$OutArray[PicFullView]= "";
$OutArray[PicThumbView]= "";
$OutArray[PicName]= "";
$OutArray[PicComments]= "";
}
return $OutArray;
}
}
$PicArray= MakePictures($MakePicturesArray);
echo $PicArray[PicThumbView];
echo $OutArray[PicComments];
}
?>
Galerie: http://www.eventbasar.de/galerie/