4images Forum & Community
4images Issues / Ausgaben => Discussion & Troubleshooting => Topic started by: mz1975 on January 29, 2007, 08:57:41 PM
-
Hi,
When a permission to category is set as follows (edit category in admin panel):
View Category: All
View Image: Users
someone who is not logged in cannot see full size images, but he or she can still see thumbnails. I would like him or her to not see thumbnails either (for example some specified thumbnail is presented: you_dont_have _permission_to_see_thumbnails.jpg).
Is it possible and easy to make such a modification (if yes - how?)
You may ask why I dont set: View Category: users. The answer is: I want not-logged-in visitor to see full list of my categories (even how many images are in categories and what are their titles), but I dont want him to see even a thumbnail.
Thanks,
Maciej
-
Try this:
http://www.4homepages.de/forum/index.php?topic=6787.msg41507#msg41507
Or this:
http://www.4homepages.de/forum/index.php?topic=11165.0
-
Hi,
Thank you for help. I will describe what I did to solve my problem. Perhaps this info will be helpful for others.
I started with: http://www.4homepages.de/forum/index.php?topic=11165.0 (http://www.4homepages.de/forum/index.php?topic=11165.0)
Since creating second set of thumbnails didn't sound good to me, I decided to create only one thumbnail (say: you_dont_have _permission_to_see_thumbnails.jpg) which is supposed to be presented instead of regular thumbnails to all who don't have permission to see images in a given category.
To do so, first apply V@no's modification http://www.4homepages.de/forum/index.php?topic=11165.msg57291#msg57291 (http://www.4homepages.de/forum/index.php?topic=11165.msg57291#msg57291) but instead of line:
$file_src_new = str_replace("/".$thumb_file_name, "/blur/".$thumb_file_name, $file_src);
insert:
$file_src_new = str_replace("/".$thumb_file_name, "/../you_dont_have _permission_to_see_thumbnails.jpg", $file_src);
assuming that you_dont_have _permission_to_see_thumbnails.jpg is placed in data/thumbnails/ folder.
Next problem I faced was to exclude categories set to "View Image: Users" from random image. It didn't look nice when my you_dont_have _permission_to_see_thumbnails.jpg showed up as a random image. I found a couple of posts on this forum regarding this issue. Unfortuanatelly, all of them (all I have read) are about excluding a static array of cat_id. So I did as follows:
In include/functions.php find:
srand((float)microtime() * 1000000);
$category_id = array_rand($random_image_cache);
and replace with:
$sql = "SELECT cat_id FROM ".CATEGORIES_TABLE." WHERE auth_viewimage=0";
$result = $site_db->query($sql);
$index=0;
while($temp = $site_db->fetch_array($result))
{
$inrand[$index] = $temp['cat_id'];
$index = $index+1;
}
$site_db->free_result($result);
$index = array_rand($inrand);
$category_id = $inrand[$index];
Actually, the first line:
$sql = "SELECT cat_id FROM ".CATEGORIES_TABLE." WHERE auth_viewimage=0";
may be replaced with any other condition to apply a different rule of exclusion.
Although the above mentioned mods work fine on my website, I cannot take any responsibility of how they work on any other website. I am beginner in php and mysql.
Regards,
Maciej