4images Forum & Community

4images Issues / Ausgaben => Discussion & Troubleshooting => Topic started by: that Dude on March 20, 2005, 07:27:53 PM

Title: Exclude a folder for randome image section
Post by: that Dude on March 20, 2005, 07:27:53 PM
Is it possible to exclude a folder from the randome image section? Thanks!
Title: Re: Exclude a folder for randome image section
Post by: that Dude 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!
Title: Re: Exclude a folder for randome image section
Post by: V@no 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
Title: Re: Exclude a folder for randome image section
Post by: that Dude on March 22, 2005, 04:06:28 AM
You are just awesome! Thanks a lot!
Title: Re: Exclude a folder for randome image section
Post by: syndrom 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?
Title: Re: Exclude a folder for randome image section
Post by: syndrom on March 24, 2005, 08:32:52 PM
anyone? :roll:
Title: Re: Exclude a folder for randome image section
Post by: V@no on March 25, 2005, 12:17:23 AM
made a misstake while applying the patch?
Title: Re: Exclude a folder for randome image section
Post by: syndrom 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.


Title: Re: Exclude a folder for randome image section
Post by: V@no on March 25, 2005, 02:31:14 PM
actualy it is...this only works when random_cat_image is enabled...:?
Title: Re: Exclude a folder for randome image section
Post by: V@no 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";
Title: Re: Exclude a folder for randome image section
Post by: syndrom on March 25, 2005, 03:23:06 PM
thanks for ur help v@no, but it dont werks :(
any other idea?
Title: Exclude single images
Post by: fifinger 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
Title: Re: Exclude a folder for randome image section
Post by: nika2000 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 :-(
Title: Re: Exclude a folder for randome image section
Post by: V@no 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
Title: Re: Exclude a folder for randome image section
Post by: RoadDogg 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
Title: Re: Exclude a folder for randome image section
Post by: Fastian on April 11, 2006, 08:13:21 PM
Hi

I also want to do this. I have a category of Religious wallpaper and I want to block them to show up in random.
But it’s not working. I mean I can still see the image in “random images”
Do I need to change anything?? (May be coz I just want to block one category)
Title: Re: Exclude a folder for randome image section
Post by: Fastian on April 12, 2006, 09:04:43 AM
This is becoming important for me now so I am asking again.
It’s not working on v1.7.1.  :(
(I can still see the images from this category under new images)

Before I thought it’s me be coz I am trying to exclude only one category but now I m pretty much sure that’s its not working. I tried it with two categories by exactly following the post.

Is there anything else I can do?? 
Please Help.
Title: Re: Exclude a folder for randome image section
Post by: V@no on April 12, 2006, 02:53:37 PM
(I can still see the images from this category under new images)
what? we were not discusing random NEW images on home page and you didnt even mention this!
and besides that, 4images does not randomize new images, so you must have installed a mod that randomize them, in that case you know the drill ;)
Title: Re: Exclude a folder for randome image section
Post by: darkwarlord on April 12, 2006, 09:42:09 PM
I can't get this to work either.

I tried to exclude my wallpapers folder. They still show up.

;( hehe.
Title: Re: Exclude a folder for randome image section
Post by: Art By Vicky on March 30, 2008, 08:11:31 PM
This is what I need also.  I want to exclude 2 categories and their subcategories.  I've applied the code to the function.php file and am still getting images from those categories.  How can I get this to work?  I am using 1.7.6.

Thank you to whomever can help!