Author Topic: Random pictures  (Read 229433 times)

0 Members and 1 Guest are viewing this topic.

Offline nikolas22t

  • Pre-Newbie
  • Posts: 7
    • View Profile
    • http://www.mplampla.com
Re: Random pictures
« Reply #15 on: July 06, 2005, 01:14:37 PM »
Is there any way to change it to have 2 rows of 4 pictures and
of course the 3 new pictures?

or put two variables for rows to cells in order to add as many you want?

Offline Lunique

  • Full Member
  • ***
  • Posts: 109
  • V 1.7.7
    • View Profile
Re: Random pictures
« Reply #16 on: August 20, 2005, 06:52:05 PM »
I have to more questions:

Is it possible to get the same for the categories?
Is it possible that only the pictures are shown and not "image name", "new", "user name" or else?

would be sooo great if you could help me!

hugs Luna

Offline donpedro

  • Full Member
  • ***
  • Posts: 110
    • View Profile
    • Baden bei Wien - Fotos einer Stadt
Re: Random pictures
« Reply #17 on: August 30, 2005, 07:23:16 PM »
Hi,

can anyone tell me if it works in 4images 1.6 too ?

regards
dp

Michael

  • Guest
Re: Random pictures
« Reply #18 on: September 23, 2005, 09:32:22 PM »
Hallo,

kann man die Zufallsbilder nach Hits oder Votes anzeigen lassen?

Michael

  • Guest
Re: Random pictures
« Reply #19 on: September 24, 2005, 12:23:19 AM »
Nun hab ich zu mindestens herausgefunden wie man mehrere Zellen einbindet.

suche in includes/page_header.php nach
Code: [Select]
$random_image = (defined("SHOW_RANDOM_IMAGE") && SHOW_RANDOM_IMAGE == 0) ? "" : get_random_image();
$site_template->register_vars("random_image", $random_image);
unset($random_image);

ersetzte es dann gegen:
Code: [Select]
$random_image = (defined("SHOW_RANDOM_IMAGE") && SHOW_RANDOM_IMAGE == 0) ? "" : get_random_image();
$random_image2 = (defined("SHOW_RANDOM_IMAGE") && SHOW_RANDOM_IMAGE == 0) ? "" : get_random_image();
$site_template->register_vars("random_image", $random_image);
$site_template->register_vars("random_image2", $random_image2);
unset($random_image);
unset($random_image2);

füge dann folgendes unter Venos Random Images in der Index.php hinzu:
Code: [Select]
//------------------------------------
//------- Random Images_2 --------------
//------------------------------------
$num_new_images = $config['image_cells'];
$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)  {
 $random_images_2 = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\"><tr class=\"imagerow1\"><td>";
//  $random_images_2 .= $lang['no_new_images'];
 $random_images_2 .= "</td></tr></table>";
}
else  {
 $random_images_2 = "<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_2 .= "<tr class=\"imagerow".$row_bg_number."\">\n";
   }
   $random_images_2 .= "<td width=\"".$imgtable_width."\" valign=\"top\">\n";

   show_image($image_row);
   $random_images_2 .= $site_template->parse_template("thumbnail_bit");
   $random_images_2 .= "\n</td>\n";
   $count++;
   if ($count == $config['image_cells']) {
     $random_images_2 .= "</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_2 .= "<td width=\"".$imgtable_width."\">\n&nbsp;\n</td>\n";
     }
     $random_images_2 .= "</tr>\n";
   }
 }
 $random_images_2 .= "</table>\n";
} // end else


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

//----- End Random Images_2---------

in der home.html {random_images_2} entsprechend einbinden

Das ganze kann man beliebig verlängern  :)

Offline donpedro

  • Full Member
  • ***
  • Posts: 110
    • View Profile
    • Baden bei Wien - Fotos einer Stadt
Re: Random pictures
« Reply #20 on: September 25, 2005, 01:21:02 AM »
Hi Michael,

sieht gut aus, was Du da so machst !

dp

Michael

  • Guest
Re: Random pictures
« Reply #21 on: September 25, 2005, 11:50:17 AM »
Danke  :D

Nun weiß ich aber immer noch nicht wie ich die Random Bilder aus bestimmten Kategorien auslesen lasse.
Hatte schon folgende Idee, leider funktioniert es nicht.
AND i.cat_id IN (xx, xx, xx)

Offline GeXX

  • Pre-Newbie
  • Posts: 8
    • View Profile
Re: Random pictures
« Reply #22 on: September 27, 2005, 10:06:28 AM »
Maybe this will help:

Vielleicht hilft Dir das ja ein wenig weiter:

http://www.4homepages.de/forum/index.php?topic=9774.0

Offline GeXX

  • Pre-Newbie
  • Posts: 8
    • View Profile
Re: Random pictures
« Reply #23 on: September 27, 2005, 01:26:41 PM »
try this:

Code: [Select]
$cat_in = array(2,7,8,11,12,15,16,18); //list of category ids // *** TO FILTER 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").") AND i.cat_id IN (".implode(", ", $cat_in).")
       ORDER BY RAND()
       LIMIT $num_new_images";

Michael

  • Guest
Re: Random pictures
« Reply #24 on: September 27, 2005, 02:52:09 PM »
Vielen Dank, das klappte auf Anhieb  :D

Schön wäre es wenn nun nur noch Bilder aus den erwählten Kategorien erscheinen würden die mindestens 9 Punkte haben,
also eine Selektierung nach Bewertungen.


 

Offline GeXX

  • Pre-Newbie
  • Posts: 8
    • View Profile
Re: Random pictures
« Reply #25 on: September 27, 2005, 03:53:37 PM »
just add to the line

Code: [Select]
WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.cat_id IN (".get_auth_cat_sql("auth_viewcat").") AND i.cat_id IN (".implode(", ", $cat_in).")
this:
Code: [Select]
AND i.image_votes > 8
thats all...

by the way: your site looks nice!

Michael

  • Guest
Re: Random pictures
« Reply #26 on: September 27, 2005, 04:22:30 PM »
super great  :D

and
Code: [Select]
i.image_rating > 7  is for rating   :mrgreen:

1000x thanks

Offline TIMT

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
Re: Random pictures
« Reply #27 on: December 11, 2005, 11:52:52 PM »
how can I show the pictures whitout the name of the photagrapher and without the name of the picture? I want to show just the image.


Offline Acidgod

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 2.421
  • It's me?
    • View Profile
    • Flash-Webdesign
Re: Random pictures
« Reply #28 on: December 12, 2005, 12:07:28 AM »
You must edit the random_image.html ...(o:

Offline TIMT

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
Re: Random pictures
« Reply #29 on: December 12, 2005, 07:28:38 PM »
Can I have a second random_image.html? For the random image shown on each site, the layout is ok (user- and imagename). Only the random images on my entrance-site should be displayed without user- / imagename.

Thanks!