Author Topic: The good old "last Images"  (Read 17503 times)

0 Members and 1 Guest are viewing this topic.

Offline www.katzen.ag

  • Jr. Member
  • **
  • Posts: 75
  • KatzenAG - das grosse Katzenportal im Internet
    • View Profile
    • KatzenAG - das grosse Katzenportal im Internet
The good old "last Images"
« on: November 07, 2007, 09:37:33 PM »
Hello everyone!

I searched and searched and I've found a lot of topics about last images.
What I want is just a simple solution to show the last (e.g. last 5) images at the main page.
I've found topics how to show images in phpbb etc but I want to show simple at my 4images main page with smals pics (eg. 60x45)

At the moment I have this:



I want:


I already installed a lot of mods, but this item makes me sick because I want them but I'am to stupid to do it. :cry:
May be someone can help me?!?


Best regards,
KatzenAG
KatzenAG - das grosse Katzenportal im Internet

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: The good old "last Images"
« Reply #1 on: November 07, 2007, 09:56:02 PM »
// Step 1

In index.php file,

find:

Code: [Select]
unset($new_images);

add after:

Code: [Select]
//-----------------------------------------------------
//--- Show Last images with thumbnails ----------------
//-----------------------------------------------------
$sql1 = "

SELECT i.image_id, i.image_name, i.image_thumb_file, i.image_media_file, i.cat_id" . get_user_table_field(", u.", "user_name") . "
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 = c.cat_id AND (i.cat_id NOT IN (".get_auth_cat_sql("auth_viewimage", "NOTIN").", ".get_auth_cat_sql("auth_viewcat", "NOTIN")."))
ORDER BY i.image_date DESC
LIMIT 5

";

$result = $site_db->query($sql1);
$num_rows = $site_db->get_numrows($result);

if (!$num_rows)  {
  $last_images_with_thumbnails = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\"><tr class=\"imagerow1\"><td>";
  $last_images_with_thumbnails .= $lang['no_new_images'];
  $last_images_with_thumbnails .= "</td></tr></table>";
}
else  {
  $last_images_with_thumbnails = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\">";
  $count = 0;
  $bgcounter = 0;
  while ($last_images_with_thumbnails_row = $site_db->fetch_array($result)) {
      $user_name = format_text(trim(ucfirst($last_images_with_thumbnails_row[$user_table_fields['user_name']]), 2));
     
    if ($count == 0) {
      $row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;
      $last_images_with_thumbnails .= "<tr class=\"imagerow".$row_bg_number."\">\n";
    }
    $last_images_with_thumbnails .= "<td width=\"".$imgtable_width."\" valign=\"top\">\n";

    show_image($last_images_with_thumbnails_row);
    $last_images_with_thumbnails .= $site_template->parse_template("thumbnail_bit");
    $last_images_with_thumbnails .= "\n</td>\n";
    $count++;
    if ($count == $config['image_cells']) {
      $last_images_with_thumbnails .= "</tr>\n";
      $count = 0;
    }
  } // end while

  if ($count > 0)  {
    $leftover = ($config['image_cells'] - $count);
    if ($leftover >= 1) {
      for ($f = 0; $f < $leftover; $f++) {
        $last_images_with_thumbnails .= "<td width=\"".$imgtable_width."\">\n&nbsp;\n</td>\n";
      }
      $last_images_with_thumbnails .= "</tr>\n";
    }
  }
  $last_images_with_thumbnails .= "</table>\n";
} // end else


$site_template->register_vars("lang_last_images_with_thumbnails_from_home", preg_replace("/" . $site_template->start . "user_name" . $site_template->end . "/siU", $user_name, $lang['last_images_with_thumbnails_from_home']));
$site_template->register_vars("last_images_with_thumbnails", $last_images_with_thumbnails);
unset($last_images_with_thumbnails);

// Step 2

In lang/english/main.php file,

add in top ?>:

Code: [Select]
$lang['last_images_with_thumbnails_from_home'] = "Latest images with thumbnails";

// Step 3

In templates/your_template/home.html file,

find:

Code: [Select]
<td class="head1">{new_images}</td>
                    </tr>                       
                  </table>
                  <br />

add after:

Code: [Select]
{if last_images_with_thumbnails}
<table width="450" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td class="head1">
                        <table width="100%" border="0" cellspacing="0" cellpadding="4">
                          <tr>
                            <td class="head1" valign="top">{lang_last_images_with_thumbnails_from_home}</td>
                          </tr>
                        </table>
                      </td>
                    </tr>
                    <tr>
                      <td class="head1">{last_images_with_thumbnails}</td>
                    </tr>                       
                  </table>
                  <br />
{endif last_images_with_thumbnails}

(or place block where you like for place in home.html file).

Finish.
« Last Edit: November 07, 2007, 10:20:54 PM by kai »
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: The good old "last Images"
« Reply #2 on: November 08, 2007, 04:30:28 AM »
Quote
« Last Edit: November 07, 2007, 10:20:54 PM by kai »

I no take responsible for code no edit by me and is no authorize for this edit.
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline kai

  • Administrator
  • Addicted member
  • *****
  • Posts: 1.423
    • View Profile
    • 4images - Image Gallery Management System
Re: The good old "last Images"
« Reply #3 on: November 08, 2007, 08:43:53 AM »
@ thunderstike: Please always use the "code" BBcode for posting code segments, not the "quote" bbcode
Your first three "must do" before you ask a question:
1. Forum rules
2. FAQ
3. Search

Offline www.katzen.ag

  • Jr. Member
  • **
  • Posts: 75
  • KatzenAG - das grosse Katzenportal im Internet
    • View Profile
    • KatzenAG - das grosse Katzenportal im Internet
Re: The good old "last Images"
« Reply #4 on: November 08, 2007, 12:28:19 PM »
Wow! Great support, thunderstrike!!  :D
I will try this today and than I will give a feedback after modification...

Thanks a lot!

Best regards,
KatzenAG

 
KatzenAG - das grosse Katzenportal im Internet

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: The good old "last Images"
« Reply #5 on: November 08, 2007, 03:16:00 PM »
Quote
@ thunderstike: Please always use the "code" BBcode for posting code segments, not the "quote" bbcode

I say in PM 2 time - I use BBCode and is error in forum. Please correct and send me message so I correct :!:
Each edit from other for my post is each message to all user I post.

Quote
Thanks a lot!

Is no problem - thank for posting.
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline www.katzen.ag

  • Jr. Member
  • **
  • Posts: 75
  • KatzenAG - das grosse Katzenportal im Internet
    • View Profile
    • KatzenAG - das grosse Katzenportal im Internet
Re: The good old "last Images"
« Reply #6 on: November 08, 2007, 07:12:38 PM »
Hi!

Yes it works perfect already.
I made a new thumbnail_bit ---> "thumbnail_bit_last_images" and changed that in index.php. I removed the lightbox and other things, there is just the thumb.
I need just one thing: I would like have the thumbs smaller in 60*45 px.

Any idea?
« Last Edit: November 08, 2007, 07:31:37 PM by www.katzen.ag »
KatzenAG - das grosse Katzenportal im Internet

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: The good old "last Images"
« Reply #7 on: November 08, 2007, 07:15:54 PM »
Oh ... is need recode ...
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline www.katzen.ag

  • Jr. Member
  • **
  • Posts: 75
  • KatzenAG - das grosse Katzenportal im Internet
    • View Profile
    • KatzenAG - das grosse Katzenportal im Internet
Re: The good old "last Images"
« Reply #8 on: November 08, 2007, 08:31:20 PM »
Ah,...is ok...I could put this Item in to the Jobs threat...

However, thanks.

 
KatzenAG - das grosse Katzenportal im Internet

Offline Nicky

  • Administrator
  • 4images Guru
  • *****
  • Posts: 3.195
    • View Profile
Re: The good old "last Images"
« Reply #9 on: November 08, 2007, 09:16:03 PM »
here die lösung, damit du jeweils 2 verschiedene thumbnails zeigen kannst

öffne die includes/functions.php

suche nach
Code: [Select]
    "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),

drunter füge dies ein
Code: [Select]
    "thumbnail_last_images" => get_thumbnail_code_last_images($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),

in der selben datei suche nach
Code: [Select]
function get_thumbnail_code($media_file_name, $thumb_file_name = "", $image_id, $cat_id, $image_name = "", $mode = "", $show_link = 1, $open_window = 0) {

davor füge dies ein
Code: [Select]
function get_thumbnail_code_last_images($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=\"60\" height=\"45\" alt=\"".$image_name."\" />";
    }
  }

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

nur folgenden code von thunderstrike für die index.php ändern
von
Code: [Select]
    $last_images_with_thumbnails .= $site_template->parse_template("thumbnail_bit");

auf

Code: [Select]
    $last_images_with_thumbnails .= $site_template->parse_template("thumbnail_bit_last_images");

neues template erstellen, namens thumbnail_bit_last_images.html

und dies einfügen (kannst alles löschen ausser {thumbnail_last_images})
Code: [Select]
<!-- you wish detail page in a small javascript open window, use {thumbnail_openwindow} -->
{thumbnail_last_images}<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}

damit kannst 2 verschiedene thumbnails benutzen..
1 x so wie früher
1 x  (60x45px) ;)

rest bleibt gleich wie thunderstrike beschrieben hat.
cheers
Nicky
Your first three "must do" before you ask a question ! (© by V@no)
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

nicky.net 4 4images
Signature stolen from mawenzi

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: The good old "last Images"
« Reply #10 on: November 08, 2007, 09:18:26 PM »
And ... english ?
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline Nicky

  • Administrator
  • 4images Guru
  • *****
  • Posts: 3.195
    • View Profile
Re: The good old "last Images"
« Reply #11 on: November 08, 2007, 09:26:24 PM »
englisch?

here demo > http://www.nicky.net/4test/
cheers
Nicky
Your first three "must do" before you ask a question ! (© by V@no)
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

nicky.net 4 4images
Signature stolen from mawenzi

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: The good old "last Images"
« Reply #12 on: November 08, 2007, 09:27:15 PM »
Ok - is good but you post instruction - is need in english too. ;)
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline Nicky

  • Administrator
  • 4images Guru
  • *****
  • Posts: 3.195
    • View Profile
Re: The good old "last Images"
« Reply #13 on: November 08, 2007, 09:32:06 PM »
oooooooooooooh...... coming :)

should i edit your post?
cheers
Nicky
Your first three "must do" before you ask a question ! (© by V@no)
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

nicky.net 4 4images
Signature stolen from mawenzi

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: The good old "last Images"
« Reply #14 on: November 08, 2007, 09:38:00 PM »
Quote
should i edit your post?

And why  :?:
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?