4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Requests & Discussions) => Topic started by: darvid on June 17, 2007, 04:43:46 PM

Title: [MOD] Neueste Bilder in WORDPRESS / Newest pics in WORDPRESS
Post by: darvid on June 17, 2007, 04:43:46 PM
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/ (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À!!
Title: Re: [MOD] Neueste Bilder in WORDPRESS / Newest pics in WORDPRESS
Post by: ccsakuweb on June 18, 2007, 03:54:48 AM
Hi nice mod. I would like to use wordpress in my gallery.. but i don't want integrate my 4images with phpbb  :| is it necessary?
Title: Re: [MOD] Neueste Bilder in WORDPRESS / Newest pics in WORDPRESS
Post by: darvid on June 18, 2007, 10:33:00 AM
well, the idea behind that, is that all components use ONE database. in this type of integration wordpress and 4images use the databasetables of phpbb. to use 4images and wordpress together, there is right now no other solutions, i believe. however, u can try to integrate them and tell us how you did it  :lol:

an workaround could be to do the integration like I described it and to hide phpbb. in wordpress there are some other forum plugins u could use, but I think this post doesnt belong here.
Title: Re: [MOD] Neueste Bilder in WORDPRESS / Newest pics in WORDPRESS
Post by: ccsakuweb on July 18, 2007, 02:35:44 PM
Hi! I created other gallery and integrated with wordpress. I tried this mod and works right. Thank you ^^
i will try most rated pics ;)
Title: Re: [MOD] Neueste Bilder in WORDPRESS / Newest pics in WORDPRESS
Post by: kai on July 18, 2007, 03:14:47 PM
Gute Arbeit!
Title: Re: [MOD] Neueste Bilder in WORDPRESS / Newest pics in WORDPRESS
Post by: ccsakuweb on July 18, 2007, 05:05:20 PM
Hi! I did some modifications. Now I can see the last images from the author blog. In example, www.miblog.es/ndex.php?author=2 i will see blog from author 2 and last images from author 2. If i have the next url: http://www.miblog.es/index.php i will see the last images in the gallery from all authors. I did the next:

search:
Code: [Select]
// 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);

replace to:
Code: [Select]
$autor=$_GET["author"];
if(!$autor){
// 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);
}else{
$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.user_id=$autor
        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);

}
Title: Re: [MOD] Neueste Bilder in WORDPRESS / Newest pics in WORDPRESS
Post by: *handsome* on December 25, 2008, 08:27:53 AM
i want to use this mod but the problem is that my wordpress and 4images useing different Database :-s let me know how can i use it?
Title: Re: [MOD] Neueste Bilder in WORDPRESS / Newest pics in WORDPRESS
Post by: fast on June 16, 2009, 05:30:39 PM
ich bin auf der Suche nach einem HTML Code, der via Plugin auf einer externen Wordpress-Site eingespielt werden soll. Dargestellt werden sollen die letzten 5 hinzugefügten Bilder. Kann jmd. helfen?