Author Topic: more then 1 random or new images..  (Read 3576 times)

0 Members and 1 Guest are viewing this topic.

Offline webber

  • Pre-Newbie
  • Posts: 3
    • View Profile
more then 1 random or new images..
« on: December 04, 2006, 08:08:52 PM »
hi to all,

i had wandered through this whole forum, but m not able to find what i was luking for...., well things i need are:


    1. Random images with little bigger size then normal(say 350 X 200), fading in and out in flash.

     2. minimum 5 new images horizontally fitted and linked to their respective catagory.


letting mi finger crossed for ne possible answers...

webber

manurom

  • Guest
REWRITE NEW_IMAGES TO LINK TO CATEGORIES:
« Reply #1 on: December 06, 2006, 02:24:46 AM »
Hello;
I'm a total ignorant in interaction between Flash and PHP, sorry for first request.
For second request, maybe I can help. In fact, we do not have to modify "thumbnail_bit.html" in the used template, as a few files parse it. So we have to rewrite some bits of code, and create our own html file to generate links. So let's go on:

                    REWRITE NEW_IMAGES TO LINK TO CATEGORIES:
                    Files to modify:
                    _ /includes/functions.php
                    _ index.php

                    File to create:
                    _ /templates/your_template/catthumb_bit.html

>>>>>>>>> STEP 1_ Edit the file /includes/functions.php, and find:
Quote
    "thumbnail" => get_thumbnail_code($image_row['image_media_file'], $image_row['image_thumb_file'], $image_row['image_id'], $image_row['cat_id'], $image_row['image_name'], $mode, $show_link),

          Insert after:
Quote
   "catthumb" => get_catthumb_code($image_row['image_media_file'], $image_row['image_thumb_file'], $image_row['image_id'], $image_row['cat_id'], $image_row['image_name'], $mode, $show_link),

          Find after, around the line #500:
Quote
      $thumb = "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id.((!empty($mode)) ? "&amp;mode=".$mode : ""))."\">".$thumb."</a>";
    }
  }
  return $thumb;
}

          Just after, add this code:
Quote
//--Function catthumb to link thumbnail to its category
function get_catthumb_code($media_file_name, $thumb_file_name = "", $image_id, $cat_id, $image_name = "", $mode = "", $show_link = 1, $open_window = 0) {
  global $site_sess, $config;

  if (!check_media_type($media_file_name)) {
    $thumb = "<img src=\"".ICON_PATH."/404.gif\" border=\"0\" alt=\"\" />";
  }
  else {
    if (!get_file_path($thumb_file_name, "thumb", $cat_id, 0, 0)) {
      $file_src = ICON_PATH."/".get_file_extension($media_file_name).".gif";
      $image_info = @getimagesize($file_src);
      $width_height = (!empty($image_info[3])) ? " ".$image_info[3] : "";
      $thumb = "<img src=\"".$file_src."\" border=\"0\"".$width_height." alt=\"".$image_name."\" />";
    }
    else {
      $file_src = get_file_path($thumb_file_name, "thumb", $cat_id, 0, 1);
      $image_info = @getimagesize($file_src);
      $width_height = (!empty($image_info[3])) ? " ".$image_info[3] : "";
      $thumb = "<img src=\"".$file_src."\" border=\"".$config['image_border']."\"".$width_height." alt=\"".$image_name."\" />";
    }
  }

  if ($show_link) {
    if ($open_window) {
      $thumb = "<a href=\"".$site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$cat_id.((!empty($mode)) ? "&amp;mode=".$mode : ""))."\" onclick=\"opendetailwindow()\" target=\"detailwindow\">".$thumb."</a>";
    }
    else {
      $thumb = "<a href=\"".$site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$cat_id.((!empty($mode)) ? "&amp;mode=".$mode : ""))."\">".$thumb."</a>";
    }
  }
  return $thumb;
}
//--End function catthumb


          Save this file.

>>>>>>>> STEP 2_ Edit index.php

          Find:
Quote
$templates_used = 'home,category_bit,whos_online,thumbnail_bit';

          Replace by:
Quote
$templates_used = 'home,category_bit,whos_online,thumbnail_bit,catthumb_bit';

          Then, find:
Quote
$num_new_images = $config['image_cells'];

          To display 5 thumbnails tiled horizontally, change by:
Quote
$num_new_images = 5;
$config['image_cells'] = 5;

          And finally, find:
Quote
    $new_images .= $site_template->parse_template("thumbnail_bit");

          To activate the HTML link to categories, replace by:
Quote
    $new_images .= $site_template->parse_template("catthumb_bit");
         
>>>>>>>>> STEP 3_ Well now, it's time to create a file /templates/your_template/catthumb_bit.html with this code:
         
Quote
<div align="center">{catthumb}<br />
  <b>{image_name}</b> {if image_is_new}<sup class="new">{lang_new}</sup>{endif image_is_new} ({user_name_link})
  <br />
  <a href="{cat_url}">{cat_name}</a><br />
{if allow_comments}{lang_comments} {image_comments}{endif allow_comments}<br />
{lightbox_button}</div>

          Save this file and test your website, better in local, not to alter your live site.

Now, you should have new_images in your homepage, and each thumbnail has to link to its own category page, and not to the details page.
Hope it could help.
« Last Edit: December 06, 2006, 02:36:38 AM by manurom »

Offline webber

  • Pre-Newbie
  • Posts: 3
    • View Profile
Re: more then 1 random or new images..
« Reply #2 on: December 22, 2006, 06:19:56 AM »
thaks bro, the new images part did worked

i got a new problem now

the thumbnails of the added images are not showing up. i have already checked, the gd is installed on mi server, i have selected gd to cut down images in the admin section.


thankyou

nishant kalia