Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - fabulous

Pages: [1]
1
Discussion & Troubleshooting / 2 different thumb sizes
« on: March 27, 2003, 01:19:00 AM »
Hi there,
i love 4imgages and i love especially love this forum and V@no :roll: :D

i just read http://www.4homepages.de/forum/viewtopic.php?t=4060 and i love it. i applied it to my start page and it works perfect.

now, I would also like to mod the size of a few thumbs my top gallery and the small random thumb in gallery listing. all in all i need 3 different thumbnail sizes on my page, ratio should allways be used (so if it is horizontal i do not want to a 200*200 thumb but a 200*100 e.g).

    first i need my regular 200*200 thumb (maximum), this one is used when i'm in a category, on the start page and as random pic.
    second, i need a 100*100 max thumb, which should be used in the top gallery, showing the top 50 fotos by hits and also on the start page next to the last commented fotos. this part is already working.
    third, i would need a 50*50 max thumb, this one i would like to use also on the start page instead of the 50*37 fix size thumb in category listing in the top part of the start page.[/list:u]

    now my problem: i tried to modify the code V@no gave in the already mentioned thread. i tried to modify my top.php where the important code looks as follows:
Code: [Select]
// Hits
$sql = "SELECT i.image_id, i.user_id, i.cat_id, i.image_name, i.image_hits, c.cat_name".get_user_table_field(", u.", "user_name").", i.image_thumb_file
        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 i.cat_id NOT IN ($cat_id_sql) AND i.cat_id = c.cat_id
        $cat_match_sql
        ORDER BY i.image_hits DESC, i.image_name ASC
        LIMIT 50";
$result = $site_db->query($sql);
$top_list = array();
$i = 1;
while ($row = $site_db->fetch_array($result)) {
  $top_list[$i] = $row;
  $i++;
}
$site_db->free_result();

for ($i = 1; $i <= 50; $i++) {
  if (isset($top_list[$i])) {
    $register_array['image_hits_'.$i] = (check_permission("auth_viewimage", $top_list[$i]['cat_id'])) ? "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$top_list[$i]['image_id'])."\">".htmlspecialchars($top_list[$i]['image_name'])."</a>" : htmlspecialchars($top_list[$i]['image_name']);
    $register_array['image_hits_openwindow_'.$i] = (check_permission("auth_viewimage", $top_list[$i]['cat_id'])) ? "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$top_list[$i]['image_id'])."\" onclick=\"opendetailwindow()\" target=\"detailwindow\">".htmlspecialchars($top_list[$i]['image_name'])."</a>" : htmlspecialchars($top_list[$i]['image_name']);
    if (isset($top_list[$i][$user_table_fields['user_name']]) && $top_list[$i]['user_id'] != GUEST) {
      $user_profile_link = (!empty($url_show_profile)) ? preg_replace("/{user_id}/", $top_list[$i]['user_id'], $url_show_profile) : ROOT_PATH."member.php?action=showprofile&amp;".URL_USER_ID."=".$top_list[$i]['user_id'];
      $register_array['image_hits_user_'.$i] = "<a href=\"".$site_sess->url($user_profile_link)."\">".htmlspecialchars($top_list[$i][$user_table_fields['user_name']])."</a>";
    }
    else {
      $register_array['image_hits_user_'.$i] = $lang['userlevel_guest'];
    }
    $register_array['image_hits_cat_'.$i] = "<a href=\"".$site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$top_list[$i]['cat_id'])."\">".htmlspecialchars($top_list[$i]['cat_name'])."</a>";
    $register_array['image_hits_number_'.$i] = "<b>".$top_list[$i]['image_hits']."</b>";
    $register_array['image_hits_thumb_'.$i] = "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$top_list[$i]['image_id'])."\"><img src=\"data/thumbnails/".$top_list[$i]['cat_id']."/".$top_list[$i]['image_thumb_file']."\" border=\"0\" alt=\"\" />";
  }
  else {
    $register_array['image_hits_'.$i] = "--";
    $register_array['image_hits_user_'.$i] = "--";
    $register_array['image_hits_cat_'.$i] = "--";
    $register_array['image_hits_number_'.$i] = "--";
    $register_array['image_hits_thumb_'.$i] = "--";
  }
}

i tried to add something like this:
Code: [Select]
if (!get_file_path($image_row['image_thumb_file'], "thumb", $image_row['cat_id'], 0, 0)) {
        $thumb_file = ICON_PATH."/".get_file_extension($image_row['image_media_file']).".gif";
      }else {
        $thumb_file = get_file_path($image_row['image_thumb_file'], "thumb", $image_row['cat_id'], 0, 1);
      }
      $thumb_info = @getimagesize($thumb_file);
      $width = $thumb_info[0];
      $height = $thumb_info[1];
      $dimension = 100;
      $ratio = $width / $height;
      if ($ratio > 1) {
        $new_width = $dimension;
        $new_height = floor(($dimension/$width) * $height);
      }else {
        $new_width = floor(($dimension/$height) * $width);
        $new_height = $dimension;
      }
      $site_template->register_vars(array(
        "comment_image_thumb" => (!check_permission("auth_viewcat", $cat_id) || !check_permission("auth_viewimage", $cat_id)) ? "<img src=\"".$thumb_file."\" width=\"".$new_width."\" height=\"".$new_height."\" onClick=\"alert('".$lang['members_only']."');\" border=\"".$config['image_border']."\">" : "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$comment_row[$i]['image_id'].((!empty($mode)) ? "&amp;mode=".$mode : ""))."\"><img src=\"".$thumb_file."\" width=\"".$new_width."\" height=\"".$new_height."\" border=\"".$config['image_border']."\"></a>",

i tried a bit, but i do not understand php, so i do not know what part i have to change. i would apreciate a lot if someone has a look on this issue :)
you can see the already working thums on http://www.foto-fish.de
only to be clear: the most important for me is to scale the thumbs in top.php to about half the size (100 pixel maximum height/width) instead of the now used 200 pixel size. thx in advance.

fab

2
hi forum,

first i would like to say that i really like 4images and think it is a wonderfull piece of program. thanks jan!

now my problem. my gallery is used mainly by myself. but i would like to make friends gallerys, where friends of mine can upload pictures taken by them. so i would like to add a category where only one member can upload pics. (so member litschie can only upload in category "litschie", member bass can only upload in category "bass", and so on)
as far as i understand that should be possible with usergroups, but in "befugnisse" of the newly added group "litschiegroup" where "litschie" is a member of, i cannot change anything.

any ideas ?

cheers, fab :D

www.odd-fish.de/fotos

Pages: [1]