4images Forum & Community
4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: Nicky on August 31, 2002, 10:34:00 PM
-
Update: 25.01.2008
vBulletin Version 3.6.8 and 4images 1.7.4
:flag-en:
NOTE: this mod will work ONLY if your 4images mysql tables are in SAME DATABASE like vBulletin.
:flag-de:
ACHTUNG: dieser mod funktioniert NUR wenn 4images mysql tabellen in GLEICHER DATENBANK sind wie die von vBulletin.
1.)
:flag-en: open
:flag-de: öffne
vBulletin global.php ( :flag-en: not / :flag-de: nicht admin/global.php)
:flag-en: search :flag-de: suche
?>
:flag-en: add before :flag-de: vordem füge dies
// START RANDOM PIC MOD
/**************************************************************************
* *
* 4images - A Web Based Image Gallery Management System *
* ---------------------------------------------------------------- *
* *
* File: none *
* Copyright: (C) 2002 Jan Sorgalla *
* Email: jan@4homepages.de *
* Web: http://www.4homepages.de *
* MOD for 4images 1.7.4 & vBulletin 3.6.8 *
* *
* Never released without support from: Nicky (http://www.nicky.net) *
* *
**************************************************************************
* *
* 4images ist KEINE Freeware. Bitte lesen Sie die Lizenz- *
* bedingungen (http://www.4homepages.de/4images/lizenz.php) für *
* weitere Informationen. *
* --------------------------------------------------------------- *
* 4images is NOT freeware! Please read the Copyright Notice *
* (http://www.4homepages.de/4images/lizenz_e.php) for further *
* information. *
* *
*************************************************************************/
// Set here the URL to your 4images Gallery. WITH trailing slash!
define('SCRIPT_URL', 'http://YOUR-URL-TO/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;
}
// In following queries CHANGE 4images table PREFIX if it doesn't match (Standard "4images_")!
$sql = "SELECT COUNT(*) AS total_images
FROM 4images_images
LEFT JOIN 4images_categories ON (4images_images.cat_id=4images_categories.cat_id)
WHERE 4images_images.image_active=1
AND 4images_categories.auth_viewcat=0
AND 4images_categories.auth_viewimage=0";
$row = $db->query_first($sql);
$total_images = $row['total_images'];
mt_srand((double)microtime() * 1000000);
$number = ($total_images > 1) ? mt_rand(0, $total_images - 1) : 0;
$sql = "SELECT 4images_images.image_id,4images_images.cat_id,4images_images.image_name,
4images_images.image_active,4images_images.image_thumb_file,4images_images.image_comments
FROM 4images_images
LEFT JOIN 4images_categories ON (4images_images.cat_id=4images_categories.cat_id)
WHERE 4images_images.image_active=1
AND 4images_categories.auth_viewcat=0
AND 4images_categories.auth_viewimage=0
LIMIT $number, 1";
$row = $db->query_first($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'] : SCRIPT_URL.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];
$randompic = "<a href=\"".SCRIPT_URL."details.php?image_id=$image_id\"><img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\"></a><br /><smallfont>Image Name: $image_name<br />Comments: $image_comments</smallfont>\n";
// HAVE FUN
// END RANDOM PIC MOD
1.a)
:flag-en: if you want to use it with more than one pic the use this code
:flag-de: wenn du es mit mehr bildern benutzen willst benutzen diesen code
// START RANDOM PIC MOD
/**************************************************************************
* *
* 4images - A Web Based Image Gallery Management System *
* ---------------------------------------------------------------- *
* *
* File: none *
* Copyright: (C) 2002 Jan Sorgalla *
* Email: jan@4homepages.de *
* Web: http://www.4homepages.de *
* MOD for 4images 1.7.4 & vBulletin 3.6.8 *
* *
* Never released without support from: Nicky (http://www.nicky.net) *
* *
**************************************************************************
* *
* 4images ist KEINE Freeware. Bitte lesen Sie die Lizenz- *
* bedingungen (http://www.4homepages.de/4images/lizenz.php) für *
* weitere Informationen. *
* --------------------------------------------------------------- *
* 4images is NOT freeware! Please read the Copyright Notice *
* (http://www.4homepages.de/4images/lizenz_e.php) for further *
* information. *
* *
*************************************************************************/
// Set here the URL to your 4images Gallery. WITH trailing slash!
define('SCRIPT_URL', 'http://YOUR-URL-TO/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;
}
// NUMBER OF THUMBNAILS TO DISPLAY / NUMMER DER GEWÜNSCHTEN THUMBNAILS
$num_images = 3;
// In following query CHANGE 4images table PREFIX if it doesn't match (Standard "4images_")!
$sql = "SELECT 4images_images.image_id, 4images_images.cat_id, 4images_images.image_name,
4images_images.image_active, 4images_images.image_thumb_file, 4images_images.image_comments
FROM 4images_images
LEFT JOIN 4images_categories ON (4images_images.cat_id=4images_categories.cat_id)
WHERE 4images_images.image_active=1
AND 4images_categories.auth_viewcat=0
AND 4images_categories.auth_viewimage=0
ORDER BY RAND()
LIMIT $num_images";
$result = $db->query($sql);
$randompic = "<table><tr>\n"; // START NEW TABLE
while ($row = $db->fetch_array($result)){
$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'] : SCRIPT_URL.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];
$randompic .= "<td><a href=\"".SCRIPT_URL."details.php?image_id=$image_id\"><img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\" title=\"$image_name\"></a><br /><smallfont>Image Name: $image_name<br />Comments: $image_comments</smallfont></td>\n";
}
$randompic .= "</tr></table>\n"; // END OF NEW TABLE
// HAVE FUN
// END RANDOM PIC MOD
2.)
:flag-en: in mod self change :flag-de: im mod selbst ändere
// Set here the URL to your 4images Gallery. WITH trailing slash!
// Set here your THUMBNAIL directory. Normally no need to change. WITHOUT trailing slash!
// In following queries CHANGE 4images table PREFIX if it doesn't match (Standard "4images_")!
3.)
:flag-en: now you can use $randompic in every VB template
:flag-de: jetzt kannst du $randompic in jedem VB template benützen
3.a)
:flag-en:
if you want to have the random pic only on your vB main page, then put the code into index.php & template forumhome. (don't use it in global.php!)
:flag-de:
wennst willst das zufallsbild nur auf der vB startseite erscheint, dann füge den code nur in der index.php & template forumhome. (benutze es dann nicht in der global.php!)
:flag-en: that's it.... have fun
:flag-de: das ist alles.... viel spass
-
Will this also work with vBulletin 2.2.5 or 2.2.6?
-
Will this also work with vBulletin 2.2.5 or 2.2.6?
Yes It works... :)
-
Okay, great!
Now, another question: would it be possible to do this for the vbPortals front end add-on for vBulletin? I'd like to be able to include a random image in a side block on my site's vbPortals front page.
-
sorry.
i don't have vbPortal.
i can try if you send it to me: nicky@nicky.net
-
woooooow
there are too many changes for vb to have vbportal running..
you did it allready..
try to add this code to vbportal index.php or vbp_includes.php
and the $randompic into correct template..
-
Works like a charm =) Great Add on
-
How would I get the code to extract the category name for the random image chosen and display it as a link to the category underneath the random image's name?
-
I also tried to get the random pics work as a block in vbPortals. I followed instructions as Jan said, but I still don't get it work.
So after I added the php code into the index.php of the vbPortal, where do i use the variable $randompic in? Should I go to vbPortal admin and add a PHP script block and put that variable in there?
Anyone here success in put the random pic in vbportal block, could u please help me?
Thanks
-
Okay I tried adding the code to index.php and putting $randompic in a new side block on vbPortal but that didn't work, so I made a new PHP side block, included the entire code from the random_for_VB.txt file, and added echo $randompic; at the end but that only resulted in a parse error.
EDIT: The parse error is on the last line of the code...
$randompic = "<a href=\"".SCRIPT_URL."details.php?image_id=$image_id\"><img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\"></a><br /><smallfont>Image Name: $image_name<br />Comments: $image_comments</smallfont>\n";
I'd really prefer to have the random image come up on my site's vbPortal front page, rather than the front page of the forums, but how can I do it?
And just to reask, how would I get the code to extract the category name for the random image chosen and display it as a link to the category underneath the random image's name?
-
sorry...
but i have no time to hack now my vb
to display category name
change query:
$sql = "SELECT 4images_images.image_id,4images_images.cat_id,4images_images.image_name,4images_categories.cat_name
after
$image_comments = $row['image_comments'];
add this
$cat_name = $row['cat_name'];
now add $cat_name anywhere at "$randompic="
or replace the "$randompic =":
to
$randompic = "<a href=\"".SCRIPT_URL."details.php?image_id=$image_id\"><img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\"></a><br /><smallfont>Image Name: $image_name<br />Comments: $image_comments<br /><a href=\"".SCRIPT_URL."categories.php?cat_id=$cat_id\">".$cat_name."</a></smallfont>\n";
[EDIT:]
@X-Fan,
send me the file where you put the randompic code: nicky@nicky.net
i will look on it...
-
Okay, some progress with getting a random pic in a side block on vbPortal.
What I did was to paste the code from the above text file into a php file (with <?php at the start and ?> at the end) and then uploaded it to my vbPortal includes directory.
I then created a new PHP block and edited the URL line to point to the php file in the includes directory.
The only problem with that is that the echo command has the image displayed right at the top of every vbPortals page above the header. Now my question is how do I get it to display in the specified side block and only on the main vbPortal page, rather than above the header on every page?
-
i would try:
echo "<table><tr><td>$randompic</td></tr></table>";
-
i would try:
echo "<table><tr><td>$randompic</td></tr></table>";
Wouldn't that just put it in a table at the top of the page above the header?
-
eric,
i don't know, just try it...
-
eric,
i don't know, just try it...
Tried it, and it puts it in a table above the header.
-
anyone successfully integrate random pic with the vbp? I can't get it to work. :(
TG
-
anyone successfully integrate random pic with the vbp? I can't get it to work. :(
I switched from vBPortals to vBHome (from TeckWizards.com), which does almost everything vBP does but uses far less server resources, and managed to get the random pic working fine first go!
-
Bonjour a tous sorry je suis francais
j ai bricoler un block pour vbp (beta3 2.1) qui fonctionne
je vous le donne donc
http://dedelamalice.free.fr/random.zip
voila merci a vous
-
I get a database error while using the random.php file.
Invalid SQL: SELECT COUNT(*) AS total_images
FROM vbp_images
LEFT JOIN vbp_categories ON (vbp_images.cat_id=vbp_categories.cat_id)
WHERE vbp_images.image_active=1
AND vbp_categories.auth_viewcat=0
AND vbp_categories.auth_viewimage=0
mysql error: Table 'texasout_dbforum.vbp_images' doesn't exist
mysql error number: 1146
Any ideas on this?
-
(sorry for ma english)
i want to use this mod too
but i use invisions board.
maybe anyone hier can help me?
boti
-
how to set some randompic dont show the same pic?
-
Hi,
But how can I display random images in my VbAdvanced CMPS Portal page?? I Tried but it didn't work
-
what about VB 3.0.7
-
used / benutzt wurde 4images 1.7 & vBulletin 2.2.7
E:
NOTE: this mod will work ONLY if your 4images mysql tables are in SAME DATABASE like vBulletin.
D:
ACHTUNG: dieser mod funktioniert NUR wenn 4images mysql tabellen in GLEICHER DATENBANK sind wie die von vBulletin.
1.
open / öffne
global.php (not / nicht admin/global.php)
search / suche
checkipban();
$logincode=makelogincode();
add after / nachdem füge dies
http://www.nicky.net/4images/random_for_VB.txt
in mod self change if necessery / im mod selbst ändere wenn notwendig
// Set here the URL to your 4images Gallery. WITH trailing slash!
// Set here your THUMBNAIL directory. Normally no need to change. WITHOUT trailing slash!
// In following queries CHANGE 4images table PREFIX if it doesn't match (Standard "4images_")!
now you can use $randompic in every VB template
jetzt kannst du $randompic in jedem VB template benützen
2.
if you want to have the random pic only on your vB main page, then put the code into index.php & template forumhome. (don't use it in global.php!)
wennst willst das zufallsbild nur auf der vB startseite erscheint, dann füge den code nur in der index.php & template forumhome. (benutze es dann nicht in der global.php!)
that's it.... have fun
das ist alles.... viel spass
I tried random pic in vba version 2.2.1 with vbulletin 3.6.3 and 4images 1.7.4 and it did not work , it gave me the next error :
Fatal error: Call to a member function on a non-object in /usr/home/dom005/domains/sweetss.us/public_html/forum/global.php on line 781
Any update of this mod ? :cry: :(to work in my forum
-
Where in index.php should we write the code?coz i cannot make it work...
What should we put in foumhome template? only $randompic?
Thanx!
-
Frage:
1.
open / öffne
global.php (not / nicht admin/global.php)
global.php in 4images oder global.php in Vbulletin?
ich finde in beiden nichts
-
@Nicky
1- i cannot download the txt file coz u site is blocked here in my country
2- im running vb 3.6.8 and 1.7.4
so is ur mod works with these versions
if so
Please, send me the txt to r9t@msn.com
if cannot plz attach it here
greats
Mr_LovaLove
-
hi Mr_LovaLove,
file attached in my 1st post..
1- i cannot download the txt file coz u site is blocked here in my country
yeah, at my companies proxy too ;)
-
Fatal error: Call to a member function on a non-object in /usr/home/dom005/domains/sweetss.us/public_html/forum/global.php on line
yes i got like this msg also
and im using 3.6.8 vb
4image 1.7.4
-
hi,
change both
$row = $DB_site->query_first($sql)
to
$row = $db->query_first($sql)
in MOD.
works now?
-
Perfect thanks alot
was tryin to show 3 randoms pic
but seems still not good in coding
this is my site for who want to see the random image
www.143.ae
and it will be nice if 3 randoms can be showed
@Nicky
thanks
-
hi Mr_Lova_Love:
try this
// START RANDOM PIC MOD
// Set here the URL to your 4images Gallery. WITH trailing slash!
define('SCRIPT_URL', 'http://YOUR-URL-TO/4images/');
function is_remote($file_name) {
return (preg_match('#^https?\\:\\/\\/[a-z0-9\-]+\.([a-z0-9\-]+\.)?[a-z]+#i', $file_name)) ? 1 : 0;
}
// NUMBER OF THUMBNAILS TO DISPLAY / NUMMER DER GEWÜNSCHTEN THUMBNAILS
$num_images = 3;
// In following query CHANGE 4images table PREFIX if it doesn't match (Standard "4images_")!
$sql = "SELECT 4images_images.image_id,4images_images.cat_id,4images_images.image_name,
4images_images.image_active,4images_images.image_thumb_file,4images_images.image_comments
FROM 4images_images
LEFT JOIN 4images_categories ON (4images_images.cat_id=4images_categories.cat_id)
WHERE 4images_images.image_active=1
AND 4images_categories.auth_viewcat=0
AND 4images_categories.auth_viewimage=0
ORDER BY RAND()
LIMIT $num_images";
$result = $site_db->query($sql);
while ($row = $db->fetch_array($result)){
$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'] : SCRIPT_URL.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];
$randompic = "<a href=\"".SCRIPT_URL."details.php?image_id=$image_id\"><img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\"></a><br /><smallfont>Image Name: $image_name<br />Comments: $image_comments</smallfont>\n";
}
// HAVE FUN
// END RANDOM PIC MOD
i can't test it because i don't have vbulletin at company ;)
edit:
i think we should play with tables.. because it will be shown in this order
1
2
3
-
i can't test it because i don't have vbulletin at company
lOol !! yeah like ur site in my country :P
its not working as an array
it shows me only one image
:roll:
-
i didn't have time at home yesterday to check that.
please send your VB global.php and index.php to 4images AT nicky DOT net
[EDIT]
try this
// START RANDOM PIC MOD
// Set here the URL to your 4images Gallery. WITH trailing slash!
define('SCRIPT_URL', 'http://YOUR-URL-TO/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;
}
// NUMBER OF THUMBNAILS TO DISPLAY / NUMMER DER GEWÜNSCHTEN THUMBNAILS
$num_images = 3;
// In following query CHANGE 4images table PREFIX if it doesn't match (Standard "4images_")!
$sql = "SELECT 4images_images.image_id, 4images_images.cat_id, 4images_images.image_name,
4images_images.image_active, 4images_images.image_thumb_file, 4images_images.image_comments
FROM 4images_images
LEFT JOIN 4images_categories ON (4images_images.cat_id=4images_categories.cat_id)
WHERE 4images_images.image_active=1
AND 4images_categories.auth_viewcat=0
AND 4images_categories.auth_viewimage=0
ORDER BY RAND()
LIMIT $num_images";
$result = $db->query($sql);
$randompic = "<table><tr>\n"; // START NEW TABLE
while ($row = $db->fetch_array($result)){
$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'] : SCRIPT_URL.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];
$randompic .= "<td><a href=\"".SCRIPT_URL."details.php?image_id=$image_id\"><img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\" title=\"$image_name\"></a><br /><smallfont>Image Name: $image_name<br />Comments: $image_comments</smallfont></td>\n";
}
$randompic .= "</tr></table>\n"; // END OF NEW TABLE
// END RANDOM PIC MOD
tested on VB 3.6.8 Patch Level 2..
works now with 3 pics
-
tested on VB 3.6.8 Patch Level 2..
works now with 3 pics
Perfect choice :D
thanks Nicky :mrgreen:
works fine :D
-
thanks for posting :mrgreen:
-
Hi Nicky
First, thanks for updating the topic
Kurt has another MOD which we tried to let it works with 4images that integrated with VB
but we have one problem
the session.php which is in 4images is for 1.7.2 or less << and im using this one
and PIN MOD desnt work with 4images 1.7.2 or less
here is my problem
http://www.4homepages.de/forum/index.php?topic=20034.msg110160#msg110160
if u can take a look
and its better to open a topic for the MODs which works with the integration
Sorry for posting here
Mr Lova
-
i dont want to include a category in the random
for example i have a category called cards and it tooks id = 10
i tried v@no mod
but didnt work
i will try and at same tome wating for a solution
-
i dont want to include a category in the random
for example i have a category called cards and it tooks id = 10
i tried v@no mod
but didnt work
i will try and at same tome wating for a solution
still im looking for a solution
infact, i add a video category and i dont want to show that in the VB
any solutions ?
-
i added this in the select statement
WHERE
4images_images.cat_id <> 11
untill now it works fine !!! :S
if its wrong plz correct it for me
-
example:
4images_images.cat_id NOT IN (11)