Author Topic: Exclude a folder for randome image section  (Read 20970 times)

0 Members and 1 Guest are viewing this topic.

that Dude

  • Guest
Exclude a folder for randome image section
« on: March 20, 2005, 07:27:53 PM »
Is it possible to exclude a folder from the randome image section? Thanks!

that Dude

  • Guest
Re: Exclude a folder for randome image section
« Reply #1 on: March 22, 2005, 01:37:07 AM »
Can someone please help me here?
I have six categories in my 4image gallery and one of them has graphic war pictures. Consequently, I don't want that specific category along with all its sub categories to be a part of random image display.
How can I disable that?

Thank you all for your help!

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Exclude a folder for randome image section
« Reply #2 on: March 22, 2005, 03:21:13 AM »
its not as easy as it might looks like...
try this
in includes/functions.php find:
Code: [Select]
      srand((float)microtime() * 1000000);
      $category_id = array_rand($random_image_cache);
replace with:
Code: [Select]
      $notincat = array(1,2,3,4); //add as many categories IDs as u wish
      for ($i = 0; $i < 100; $i++)
      {
        srand((float)microtime() * 1000000);
        $category_id = array_rand($random_image_cache);
        if (!in_array($category_id, $notincat)) break;
        else $category_id = -1;
      }
Quote
      $notincat = array(1,2,3,4); //add as many categories IDs as u wish
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

that Dude

  • Guest
Re: Exclude a folder for randome image section
« Reply #3 on: March 22, 2005, 04:06:28 AM »
You are just awesome! Thanks a lot!

Offline syndrom

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Exclude a folder for randome image section
« Reply #4 on: March 22, 2005, 08:19:54 AM »
hi v@no,

i have a category (with alot of subcategorys) too, that i want to hide from random image selection.
your solution did not work for me. still have random pics from excluded categorys

i have tryed
Code: [Select]
$notincat = array(68);and
Code: [Select]
$notincat = array(68,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25);
68 is the maincategory i want to hide and the other id's are subcategorys from it - i want to hide too.

any idea?



Offline syndrom

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Exclude a folder for randome image section
« Reply #5 on: March 24, 2005, 08:32:52 PM »
anyone? :roll:



Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Exclude a folder for randome image section
« Reply #6 on: March 25, 2005, 12:17:23 AM »
made a misstake while applying the patch?
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline syndrom

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Exclude a folder for randome image section
« Reply #7 on: March 25, 2005, 08:59:26 AM »
i double checked everything...

is it for the random_cat_image selection only :?:

i have disabled that for performance reasons.
want to hide some categories from random_image selection.





Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Exclude a folder for randome image section
« Reply #8 on: March 25, 2005, 02:31:14 PM »
actualy it is...this only works when random_cat_image is enabled...:?
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Exclude a folder for randome image section
« Reply #9 on: March 25, 2005, 02:34:47 PM »
try this then:
in includes/functions.php find:
Code: [Select]
  $cat_id_sql = get_auth_cat_sql("auth_viewcat", "NOTIN");Insert below:
Code: [Select]
  $cat_id_sql .= (($cat_id_sql) ? "," : "")."1,2,3,5,10,8";
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline syndrom

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Exclude a folder for randome image section
« Reply #10 on: March 25, 2005, 03:23:06 PM »
thanks for ur help v@no, but it dont werks :(
any other idea?



Offline fifinger

  • Newbie
  • *
  • Posts: 12
    • View Profile
Exclude single images
« Reply #11 on: August 03, 2005, 01:09:28 AM »
Hi,

is it possible at all to exclude single images from different categories, for example by specifying there ID's in the same way as above with the category ID's. I want to add a titel graphic as a first image in every category - with text to describe the category, but obviously don't want it to show up in the random images (since it's not an image)

Appreciate your help

Offline nika2000

  • Jr. Member
  • **
  • Posts: 64
    • View Profile
Re: Exclude a folder for randome image section
« Reply #12 on: August 17, 2005, 04:44:35 PM »
Quote
actualy it is...this only works when random_cat_image is enabled...Confused

How can I enable this?
In my galery the "mod" doesn't work too :-(

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Exclude a folder for randome image section
« Reply #13 on: September 22, 2005, 01:06:16 AM »
How can I enable this?
In my galery the "mod" doesn't work too :-(
its in includes/constants.php
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline RoadDogg

  • Sr. Member
  • ****
  • Posts: 488
    • View Profile
    • Düsipixel
Re: Exclude a folder for randome image section
« Reply #14 on: March 15, 2006, 11:26:52 AM »
I applied both variants (first suggestion, second suggestion, both together...) and random cat images are turnded on in constants.php, but categories that should not be shown in random images on mainpage still appear? I use 4images 1.7. Is there another way? Did I forget something?

includes/functions.php
Code: [Select]
  $random_image_cache = array();
  $cat_id_sql = get_auth_cat_sql("auth_viewcat", "NOTIN");
$cat_id_sql .= (($cat_id_sql) ? "," : "")."34,35,36,58,59,61";

Code: [Select]
if (SHOW_RANDOM_CAT_IMAGE) {
      $notincat = array(34,35,36,58,59,61); //add as many categories IDs as u wish
      for ($i = 0; $i < 100; $i++)
      {
        srand((float)microtime() * 1000000);
        $category_id = array_rand($random_image_cache);
        if (!in_array($category_id, $notincat)) break;
        else $category_id = -1;
      }
    }
    else {
      $category_id = 0;
    }
  }

includes/constants.php
Code: [Select]
// If you have a lot of images in your database,
// the random image function could make your programm slow.
// Try first to set "SHOW_RANDOM_CAT_IMAGE" to 0.
define('SHOW_RANDOM_IMAGE', 1);
define('SHOW_RANDOM_CAT_IMAGE', 1);

thanks
For support requests please don´t forget link to your Gallery/to phpinfo.php
Code: [Select]
<?
phpinfo()
?>
safe_mode must turned OFF
Please check Error Messages