Author Topic: Images on Main page?  (Read 5150 times)

0 Members and 1 Guest are viewing this topic.

Offline *handsome*

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
Images on Main page?
« on: September 21, 2008, 08:25:00 AM »

I am runing my Gallery here www.domain.com/gallery

i wanna show random or latest images at my main page www.domain.com

let me know is it possible?

Please guide me how can i do this

Offline batu544

  • Sr. Member
  • ****
  • Posts: 336
    • View Profile
    • Free Celebrity wallpapers
Re: Images on Main page?
« Reply #1 on: September 21, 2008, 12:51:57 PM »
Yes, this is possible.

Find  in index.php
Code: [Select]
$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 NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").")
        ORDER BY i.image_date DESC
        LIMIT $num_new_images";



Replace this with following

Code: [Select]
$new_cutoff = time() - 60 * 60 * 24 * $config['new_cutoff'];
$sql = "SELECT IF(i.image_date >= $new_cutoff,RAND()+1,1) as random_no, 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 random_no DESC, i.image_date DESC
        LIMIT $num_new_images";


It will randomize the new wallpapers ..

Thanks,

Offline KurtW

  • 4images Guru
  • *******
  • Posts: 2.778
    • View Profile
    • Malediven-Bilder ~~Dreams~~
Re: Images on Main page?
« Reply #2 on: September 21, 2008, 01:16:02 PM »
Hi,

Quote
i wanna show random or latest images at my main page

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

Kurt

Offline *handsome*

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
Re: Images on Main page?
« Reply #3 on: September 22, 2008, 07:27:24 AM »
Hi,

Quote
i wanna show random or latest images at my main page

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

Kurt


thanks for help

 

Post your comments here