Hi,
ich habe die Integration von 4Images, PHPBB und Wordpress tatsächlich hinbekommen (How-To at:
http://www.sebastianscheuer.de/aktuell/integration-von-wordpress-blog-phpbb-forum-und-4images-bildergallerie/)
Nun möchte ich natürlich Bilder auch in Wordpress anzeigen lassen.
[MOD] Neueste Bilder in WORDPRESS / Newest pics in WORDPRESS:Vorrausetzung: 4Images und Wordpress sind in der selben Datenbank! / 4Images und Wordpress must be using the same database!!Fügt in euren Wordpress-Theme Dateien folgenden Code hinein (abgewandelt von Nicky) / Put this code into your Wordpress-Theme, whereever u want:
// BEGIN letzte Bilder anzeigen
// Set here the URL to your 4images Gallery. WITH trailing slash!
define('SCRIPT_URL', 'http://www.domain.de/4images/');
// Set here your THUMBNAIL directory. Normally no need to change. WITHOUT trailing slash!
define('THUMB_DIR', 'data/thumbnails');
function is_remote($file_name) {
return (preg_match('#^https?\\:\\/\\/[a-z0-9\-]+\.([a-z0-9\-]+\.)?[a-z]+#i', $file_name)) ? 1 : 0;
}
// Set thumbnails to show
$new_thumbs = 3;
// In following query CHANGE 4images table PREFIX if it doesn't match (Standard "4images_")!
$sql = "SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file
FROM 4images_images a, 4images_categories b
WHERE a.image_active=1
AND a.cat_id = b.cat_id
AND b.auth_viewcat=0
AND b.auth_viewimage=0
ORDER BY a.image_id DESC
LIMIT $new_thumbs";
$result = $db->sql_query($sql);
$newpics = "\n<table><tr>\n";
if ($db->sql_numrows($result) > 0) {
while ($row = $db->sql_fetchrow($result)) {
$image_id = $row['image_id'];
$cat_id = $row['cat_id'];
$image_name = $row['image_name'];
$thumb_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : SCRIPT_URL.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];
$newpics .= "<td valign=\"bottom\">$image_name<br><a href=\"".SCRIPT_URL."details.php?image_id=$image_id\"><img src=\"".$thumb_src."\" border=\"1\" alt=\"$image_name\"></a></td>\n";
}
}
else {
$newpics .= "<td class=\"mainmenu\" align=\"center\">nothing here</td>\n";
}
$newpics .= "</tr></table>\n";
echo "$newpics";$new_thumbs = Anzahl der anzuzeigenden Bilder / Number of Pictures
ÄNDERE DEN PFAD ZU 4IMAGES / EDIT THE PATH TO 4IMAGES
Dort wo ihr die Bilder anzeigen wollt fügt folgenden Code hin / put this code in your WP-Theme where u want the pictures to show: <?php echo "$newpics"; ?>
VOILÀ!!