Author Topic: [Mod] Random Pic in vBulletin - Update: 25.01.2008  (Read 57990 times)

0 Members and 1 Guest are viewing this topic.

Offline Nicky

  • Administrator
  • 4images Guru
  • *****
  • Posts: 3.195
    • View Profile
Re: [Mod] Random Pic in vBulletin
« Reply #30 on: January 22, 2008, 08:40:05 PM »
hi,

change both
Code: [Select]
$row = $DB_site->query_first($sql)

to
Code: [Select]
$row = $db->query_first($sql)

in MOD.
works now?
cheers
Nicky
Your first three "must do" before you ask a question ! (© by V@no)
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

nicky.net 4 4images
Signature stolen from mawenzi

Offline Mr_LovaLove

  • Full Member
  • ***
  • Posts: 233
  • Unkown
    • View Profile
Re: [Mod] Random Pic in vBulletin
« Reply #31 on: January 23, 2008, 12:14:45 PM »
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 
English Please :@

Offline Nicky

  • Administrator
  • 4images Guru
  • *****
  • Posts: 3.195
    • View Profile
Re: [Mod] Random Pic in vBulletin
« Reply #32 on: January 23, 2008, 05:43:37 PM »
hi Mr_Lova_Love:

try this
Code: [Select]
// 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
« Last Edit: January 23, 2008, 05:54:12 PM by Nicky »
cheers
Nicky
Your first three "must do" before you ask a question ! (© by V@no)
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

nicky.net 4 4images
Signature stolen from mawenzi

Offline Mr_LovaLove

  • Full Member
  • ***
  • Posts: 233
  • Unkown
    • View Profile
Re: [Mod] Random Pic in vBulletin
« Reply #33 on: January 23, 2008, 08:06:47 PM »
Quote
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:
English Please :@

Offline Nicky

  • Administrator
  • 4images Guru
  • *****
  • Posts: 3.195
    • View Profile
Re: [Mod] Random Pic in vBulletin
« Reply #34 on: January 24, 2008, 07:49:25 AM »
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

Code: [Select]
// 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
« Last Edit: January 24, 2008, 11:26:34 AM by Nicky »
cheers
Nicky
Your first three "must do" before you ask a question ! (© by V@no)
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

nicky.net 4 4images
Signature stolen from mawenzi

Offline Mr_LovaLove

  • Full Member
  • ***
  • Posts: 233
  • Unkown
    • View Profile
Re: [Mod] Random Pic in vBulletin
« Reply #35 on: January 25, 2008, 12:17:24 PM »
Quote
tested on VB 3.6.8 Patch Level 2..
works now with 3 pics

Perfect choice :D

thanks Nicky   :mrgreen:

works fine :D

« Last Edit: January 25, 2008, 12:29:15 PM by Mr_LovaLove »
English Please :@

Offline Nicky

  • Administrator
  • 4images Guru
  • *****
  • Posts: 3.195
    • View Profile
Re: [Mod] Random Pic in vBulletin
« Reply #36 on: January 25, 2008, 03:22:58 PM »
thanks for posting  :mrgreen:
cheers
Nicky
Your first three "must do" before you ask a question ! (© by V@no)
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

nicky.net 4 4images
Signature stolen from mawenzi

Offline Mr_LovaLove

  • Full Member
  • ***
  • Posts: 233
  • Unkown
    • View Profile
Re: [Mod] Random Pic in vBulletin - Update: 25.01.2008
« Reply #37 on: January 26, 2008, 06:14:07 PM »
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
English Please :@

Offline Mr_LovaLove

  • Full Member
  • ***
  • Posts: 233
  • Unkown
    • View Profile
Re: [Mod] Random Pic in vBulletin - Update: 25.01.2008
« Reply #38 on: March 08, 2008, 02:29:04 PM »
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
English Please :@

Offline Mr_LovaLove

  • Full Member
  • ***
  • Posts: 233
  • Unkown
    • View Profile
Re: [Mod] Random Pic in vBulletin - Update: 25.01.2008
« Reply #39 on: October 11, 2008, 04:15:20 PM »
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 ?
English Please :@

Offline Mr_LovaLove

  • Full Member
  • ***
  • Posts: 233
  • Unkown
    • View Profile
Re: [Mod] Random Pic in vBulletin - Update: 25.01.2008
« Reply #40 on: October 11, 2008, 04:24:38 PM »
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
English Please :@

Offline Nicky

  • Administrator
  • 4images Guru
  • *****
  • Posts: 3.195
    • View Profile
Re: [Mod] Random Pic in vBulletin - Update: 25.01.2008
« Reply #41 on: October 11, 2008, 08:17:56 PM »
example:

Code: [Select]
   4images_images.cat_id NOT IN (11)
cheers
Nicky
Your first three "must do" before you ask a question ! (© by V@no)
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

nicky.net 4 4images
Signature stolen from mawenzi