Author Topic: Random pictures  (Read 229315 times)

0 Members and 1 Guest are viewing this topic.

Offline son_gokou

  • Full Member
  • ***
  • Posts: 199
    • View Profile
Re: Random pictures
« Reply #45 on: May 20, 2007, 03:49:56 PM »
How can i show random images on details.php using 1.7.2 ?

manurom

  • Guest
Re: Random pictures
« Reply #46 on: May 20, 2007, 06:27:26 PM »
Hello;
@ son_gokou: I understood you wanted to have a few random images when displaying another one in details. Am I right? :?:

Sorry; it's my fault.
I did not test completely.
« Last Edit: May 21, 2007, 12:09:31 AM by manurom »

Offline son_gokou

  • Full Member
  • ***
  • Posts: 199
    • View Profile
Re: Random pictures
« Reply #47 on: May 20, 2007, 07:02:42 PM »
That's exactly that :) Thanks

But i have a problem. When I did what you told me, the image doesn´t appear. It appears 404 file not found.

Offline son_gokou

  • Full Member
  • ***
  • Posts: 199
    • View Profile
Re: Random pictures
« Reply #48 on: May 23, 2007, 08:33:44 PM »
No problem.
But do you know already?

Offline ashfaq

  • Full Member
  • ***
  • Posts: 128
    • View Profile
Re: Random pictures
« Reply #49 on: July 17, 2007, 11:47:07 AM »
HOW to show only 4 random wallpaper thumbs from whole gallery on home, categories and details pages ?
One more thing how to add new pages, i mean contact form, privacy policy, disclaimer ...
Plz help i will be very thankfull to you.

Offline athar

  • Pre-Newbie
  • Posts: 1
    • View Profile
Re: Random pictures
« Reply #50 on: July 24, 2007, 05:31:11 PM »
well i need help related to random images inside categories.


how we can function to show all images as random ,  inside  a main category means it should include the sub categories too. automaticaly

Code: [Select]
$cat_in = array(5); //list of category ids // *** TO FILTER RANDOM IMAGES ***

for example i have given 5 as category id so it should automatically consider and add sub categories for this main category and show random images from them on category page as well.

and one more thing that what should we do so that in

$cat_in = array( some variable )


the values of specific category be stored in a variable "some variable" like 5,6,7,9,78,55 etc   5 is the main and test 6,7,9,78,55 are its sub categories.

kindly help plz


Jacob

  • Guest
Re: Random pictures
« Reply #51 on: July 26, 2007, 06:14:22 AM »
Hello friends,


Can you please suggest me how to exclude some categories in this code to show in random images table?

Offline sydawn

  • Newbie
  • *
  • Posts: 23
    • View Profile
Re: Random pictures
« Reply #52 on: July 29, 2007, 11:45:30 AM »
Hello

I have tried all variations of the code in this thread to get ranodm images on my details.php page and I get either:

An unexpected error occured. Please try again later.

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/beta/public_html/includes/db_mysql.php on line 116

(and I put the brackets) or it shows the page without errors but showing no thumbs at all

HELP me please.

thank you

Offline sydawn

  • Newbie
  • *
  • Posts: 23
    • View Profile
Re: Random pictures
« Reply #53 on: August 01, 2007, 08:05:40 AM »
this is sad, noone to reply...

Maybe if it goes to the paid section someone might reply  :(

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: Random pictures
« Reply #54 on: August 01, 2007, 01:47:57 PM »
Quote
Can you please suggest me how to exclude some categories in this code to show in random images table?

From FAQs, it shows WHERE cat_id IN. Simple change for: WHERE cat_id NOT IN. From (...), replace '...' with not want IDs. :)
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: Random pictures
« Reply #55 on: August 01, 2007, 01:51:10 PM »
Quote
An unexpected error occured. Please try again later.

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/beta/public_html/includes/db_mysql.php on line 116

To this from 1st page:

Quote
if ($num_rows <= 0)  {
  $random_images = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\"><tr class=\"imagerow1\"><td>";
//  $random_images .= $lang['no_new_images'];
  $random_images .= "</td></tr></table>";
}
elseif ($num_rows > 0)  {

8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline sydawn

  • Newbie
  • *
  • Posts: 23
    • View Profile
Re: Random pictures
« Reply #56 on: August 01, 2007, 10:17:24 PM »
Hello there

Thanx for the reply. Now let me get this straight, I put Vano`code into my details.php and change the part you have highligted? Is this correct?

thanking you in advance

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: Random pictures
« Reply #57 on: August 01, 2007, 11:24:14 PM »
Yes, this is right.
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline sydawn

  • Newbie
  • *
  • Posts: 23
    • View Profile
Re: Random pictures
« Reply #58 on: August 02, 2007, 12:08:47 PM »
Hi

Thanx for the suggestion =but the problem is still there. This is what I have:


unset($random_cat_image);

//------------------------------------
//------- Random Images --------------
//------------------------------------
$sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits".$additional_sql.", c.cat_name".get_user_table_field(", u.", "user_name")."
        FROM ".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c
        LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
        WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.cat_id IN (".get_auth_cat_sql("auth_viewcat").")
        ORDER BY RAND()
        LIMIT $num_new_images";
// end new
$result = $site_db->query($sql);
$num_rows = $site_db->get_numrows($result);

if ($num_rows <= 0)  {
  $random_images = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\"><tr class=\"imagerow1\"><td>";
//  $random_images .= $lang['no_new_images'];
  $random_images .= "</td></tr></table>";
}
elseif ($num_rows > 0)  {

  $random_images = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\">";
  $count = 0;
  $bgcounter = 0;
  while ($image_row = $site_db->fetch_array($result)){
    if ($count == 0) {
      $row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;
      $random_images .= "<tr class=\"imagerow".$row_bg_number."\">\n";
    }
    $random_images .= "<td width=\"".$imgtable_width."\" valign=\"top\">\n";

    show_image($image_row);
    $random_images .= $site_template->parse_template("thumbnail_bit");
    $random_images .= "\n</td>\n";
    $count++;
    if ($count == $config['image_cells']) {
      $random_images .= "</tr>\n";
      $count = 0;
    }
  } // end while

  if ($count > 0)  {
    $leftover = ($config['image_cells'] - $count);
    if ($leftover >= 1) {
      for ($f = 0; $f < $leftover; $f++) {
        $random_images .= "<td width=\"".$imgtable_width."\">\n&nbsp;\n</td>\n";
      }
      $random_images .= "</tr>\n";
    }
  }
  $random_images .= "</table>\n";
} // end else


$site_template->register_vars("random_images", $random_images);
unset($random_images);

//----- End Random Images---------
« Last Edit: August 02, 2007, 01:52:53 PM by sydawn »

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: Random pictures
« Reply #59 on: August 02, 2007, 12:31:16 PM »
Please ... no need post all line ... no use for one thing (random image). Future, with attachment / bbcode ...

Change like this in details.php file:

Quote
//------------------------------------
//------- Random Images --------------
//------------------------------------
$sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits".$additional_sql.", c.cat_name".get_user_table_field(", u.", "user_name")."
        FROM (".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c)

(highlighted)

Should work.
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?