Author Topic: [MOD] One photo big, and other small V1.1  (Read 14923 times)

0 Members and 2 Guests are viewing this topic.

Offline MrAndrew

  • Sr. Member
  • ****
  • Posts: 302
    • View Profile
    • Aviation PhotoBase
[MOD] One photo big, and other small V1.1
« on: August 27, 2010, 09:14:14 PM »
Okey, this is a final version MOD "One photo big, and other small"

Version 1.1
Javascript support

Version 1.0
First release

This was created with a big V@no support! Many thanks V@no!

Description: This mod will give you possible to show one thumbnail BIG, and other small. I.E. For something tops, when you want to see first place of image big, and second and third small images.

With new version you may add javascript support, for change thumbnails on mouseover...

DEMO There (See TOP Shots)

RMK: For this mod you need to install [MOD] Second Thumbnail Size - http://www.4homepages.de/forum/index.php?topic=25017.0
This MOD include [MOD] - Most Rates Images Today

New files: msrates.php, msrates_image.html

Files to edit: index.php, functions.php

Install

1. Create a file msrates.php with code then upload file to main directory:

Code: [Select]
<?php

$msrates_images 
time() - 60 60 24 2;

$imgtable_width ceil(intval($config['image_table_width']) / $config['image_cells']);
if ((
substr($config['image_table_width'], -1)) == "%") {
  
$imgtable_width .= "%";
}

$additional_sql "";
if (!empty(
$additional_image_fields)) {
  foreach (
$additional_image_fields as $key => $val) {
    
$additional_sql .= ", i.".$key;
  }
}

$sql "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits".$additional_sql.", c.cat_name".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 c.cat_id = i.cat_id AND i.image_date >= " 
$msrates_images " AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat""NOTIN").")
        ORDER BY i.image_rating DESC
        LIMIT 4"
;
        
$result $site_db->query($sql);
$num_rows $site_db->get_numrows($result);

if (!
$num_rows)  {
  
$msrates_new_images "<table align=\"center\" width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\"><tr class=\"imagerow1\"><td>";
  
$msrates_new_images .= $lang['no_today_images'];
  
$msrates_new_images .= "</td></tr></table>";
}
else  {
  
$msrates_new_images "<table align=\"center\" width=\"250\" border=\"0\" cellpadding=\"1\" cellspacing=\"0\">";
  
$count 0;
  
$bgcounter 0;
  while (
$image_row $site_db->fetch_array($result)) {
    
$row_bg_number = ($bgcounter++ % == 0) ? 2;

    
$msrates_new_images .= "<td width=\"25\" align=\"center\"" . (!$count 'colspan="3"' '') .">";

    
show_image($image_row);

    
$site_template->register_vars("msrates_images_type", ($count)); //is $count > 0 ?
    
$msrates_new_images .= $site_template->parse_template("msrates_image");
    
$msrates_new_images .= "</td>";
    if (!
$count)
    {
      
$msrates_new_images .= "</tr>";
    }
    
$count++;
  } 
// end while
  
$msrates_new_images .= "</table>";
}  
// end else

$site_template->register_vars("msrates_images"$msrates_new_images);
unset(
$msrates_new_images);
?>

2. Create file msrates_image.html with code: {ifno msrates_images_type}{thumbnail}{endifno msrates_images_type}{if msrates_images_type}{thumbnail_small}{endif msrates_images_type} then upload to your templates directory

3. Add to your index.php next line:

Search:
Code: [Select]
include(ROOT_PATH.'global.php');
Add after:
Code: [Select]
include(ROOT_PATH.'msrates.php');
----------------------------Update for V1.1----------------------------

4. Download attached file thumbnailviewer2.js
and upload it to the root gallery

5. Open templates/msrates_image.html and replace:


{ifno msrates_images_type}{thumbnail}{endifno msrates_images_type}{if msrates_images_type}{thumbnail_small}{endif msrates_images_type


With this:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<
script type="text/javascript" src="thumbnailviewer2.js"></script>

<
div id="loadarea">{ifno msrates_images_type}{thumbnail}{endifno msrates_images_type}<br></div>
{if 
msrates_images_type}{thumbnail_small}{endif msrates_images_type}</div>


6. Open includes/functions.php and search:

Take care, this must be your small size thumnail code!
$thumb "<img src=\"".$file_src."\" style=\"border:0;width:$thumb_width ; height:$thumb_height ;\"  alt=\"".$image_name."\"  />";

Replace:

      $thumb "<a href=\"".$file_src."\" rel=\"enlargeimage\" target=\"_blank\" rev=\"targetdiv:loadarea,fxduration: 700,link:".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id.((!empty($mode)) ? "&amp;mode=".$mode ""))."\"><img src=\"".$file_src."\" style=\"border:0;width:$thumb_width;height:$thumb_height;link:$image_url\"/></a>";


Installation complete! I hope you enjoy it!!!

P.S. In this path you can set how many pictures to show
1.
Code: [Select]
LIMIT 4"; - It will show 4 images
2.
You can set how sort you top.
Code: [Select]
ORDER BY i.image_rating DESCChange this part to change sort what you want. I.E. i.image_hits ....

DEMO:
In my gallery this MOD show as: see attach



« Last Edit: July 04, 2011, 04:13:55 PM by MrAndrew »

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: One photo big, and other small
« Reply #1 on: August 28, 2010, 01:38:24 AM »
something like this:
<?php

$msrates_images 
time() - 60 60 24 2;

$imgtable_width ceil(intval($config['image_table_width']) / $config['image_cells']);
if ((
substr($config['image_table_width'], -1)) == "%") {
  
$imgtable_width .= "%";
}

$additional_sql "";
if (!empty(
$additional_image_fields)) {
  foreach (
$additional_image_fields as $key => $val) {
    
$additional_sql .= ", i.".$key;
  }
}

$sql "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits".$additional_sql.", c.cat_name".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 c.cat_id = i.cat_id AND i.image_date >= " 
$msrates_images " AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat""NOTIN").")
        ORDER BY i.image_rating DESC
        LIMIT 3"
;
        
$result $site_db->query($sql);
$num_rows $site_db->get_numrows($result);

if (!
$num_rows)  {
  
$msrates_new_images "<table align=\"center\" width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\"><tr class=\"imagerow1\"><td>";
  
$msrates_new_images .= $lang['no_today_images'];
  
$msrates_new_images .= "</td></tr></table>";
}
else  {
  
$msrates_new_images "<table align=\"center\" width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\">";
  
$count 0;
  
$bgcounter 0;
  while (
$image_row $site_db->fetch_array($result)) {
    
$row_bg_number = ($bgcounter++ % == 0) ? 2;

    
$msrates_new_images .= "<td width=\"".$imgtable_width."\" align=\"center\" >";

    
show_image($image_row);

    
$site_template->register_vars("msrates_images_type", ($count)); //is $count > 0 ?
    
$msrates_new_images .= $site_template->parse_template("msrates_image");
    
$msrates_new_images .= "</td>";
    
$msrates_new_images .= "</tr>";
    
$count++;
  } 
// end while
  
$msrates_new_images .= "</table>";
}  
// end else

$site_template->register_vars("msrates_images"$msrates_new_images);
unset(
$msrates_new_images);
?>


Then use
Code: [Select]
{ifno msrates_images_type}{thumbnail_big}{endifno msrates_images_type}{if msrates_images_type}{thumbnail_small}{endif msrates_images_type}
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline MrAndrew

  • Sr. Member
  • ****
  • Posts: 302
    • View Profile
    • Aviation PhotoBase
Re: One photo big, and other small
« Reply #2 on: August 29, 2010, 12:55:12 PM »
Special thanks to you work fine.

Please, correct this code that to show small images next to each other below big size thumb. I can`t do this!

Many, many thanks!

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: One photo big, and other small
« Reply #3 on: August 29, 2010, 06:02:34 PM »
Replace
    $msrates_new_images .= "</tr>";
With this:
    if (!$count)
    {
      
$msrates_new_images .= "</tr>";
    }
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline MrAndrew

  • Sr. Member
  • ****
  • Posts: 302
    • View Profile
    • Aviation PhotoBase
Re: One photo big, and other small
« Reply #4 on: August 29, 2010, 09:17:58 PM »
V@no, i`m sorry..  :cry: this give me next result:

All is good, but not together :(

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: One photo big, and other small
« Reply #5 on: August 29, 2010, 11:06:15 PM »
replace
    $msrates_new_images .= "<td width=\"".$imgtable_width."\" align=\"center\" >";


with:
    $msrates_new_images .= "<td width=\"".$imgtable_width."\" align=\"center\"" . (!$count 'colspan="2"' '') .">";
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline MrAndrew

  • Sr. Member
  • ****
  • Posts: 302
    • View Profile
    • Aviation PhotoBase
Re: [MOD] One photo big, and other small
« Reply #6 on: August 30, 2010, 10:24:57 AM »
V@no, i`ve do this for my top month image... But it dublicate me thumbs, for one image show 1 big thumb, one small thumb. This is the code

Code: [Select]
<?php

$msmonth_images 
time() - 60 60 24 31;

$imgtable_width ceil(intval($config['image_table_width']) / $config['image_cells']);
if ((
substr($config['image_table_width'], -1)) == "%") {
  
$imgtable_width .= "%";
}

$additional_sql "";
if (!empty(
$additional_image_fields)) {
  foreach (
$additional_image_fields as $key => $val) {
    
$additional_sql .= ", i.".$key;
  }
}

$sql "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits".$additional_sql.", c.cat_name".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 c.cat_id = i.cat_id AND i.image_date >= " 
$msmonth_images " AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat""NOTIN").")
        ORDER BY i.image_hits DESC
        LIMIT 3"
;
        
$result $site_db->query($sql);
$num_rows $site_db->get_numrows($result);

if (!
$num_rows)  {
  
$msmonth_new_images "<table align=\"center\" width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\"><tr class=\"imagerow1\"><td>";
  
$msmonth_new_images .= $lang['no_today_images'];
  
$msmonth_new_images .= "</td></tr></table>";
}
else  {
  
$msmonth_new_images "<table align=\"center\" width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\">";
  
$count 0;
  
$bgcounter 0;
  while (
$image_row $site_db->fetch_array($result)) {
    
$row_bg_number = ($bgcounter++ % == 0) ? 2;

    
$msmonth_new_images .= "<td width=\"".$imgtable_width."\" align=\"center\" >";

    
show_image($image_row);

    
$site_template->register_vars("msmonth_images_type", ($count)); //is $count > 0 ?
    
$msmonth_new_images .= $site_template->parse_template("msmonth_image");
    
$msmonth_new_images .= "</td>";
    
$msmonth_new_images .= "</tr>";
    
$count++;
  } 
// end while
  
$msmonth_new_images .= "</table>";
}  
// end else

$site_template->register_vars("msmonth_images"$msmonth_new_images);
unset(
$msmonth_new_images);
?>

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] One photo big, and other small
« Reply #7 on: August 30, 2010, 01:58:45 PM »
Are you saying it shows wrong thumbnails?

P.S.
Ever tried use PrintScreen button and an image editor (MS Paint)? ;)
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline MrAndrew

  • Sr. Member
  • ****
  • Posts: 302
    • View Profile
    • Aviation PhotoBase
Re: [MOD] One photo big, and other small
« Reply #8 on: August 31, 2010, 05:34:20 PM »
Oh, i forgot about it!  :D

Yes, this give me next:

And, V@no, help me with this http://www.4homepages.de/forum/index.php?topic=27806.0, please

Thanks

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] One photo big, and other small
« Reply #9 on: September 01, 2010, 05:27:30 AM »
It's because you are not using the code I've posted.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Sunny C.

  • Addicted member
  • ******
  • Posts: 1.808
  • I ♥ 4I
    • View Profile
Re: [MOD] One photo big, and other small
« Reply #10 on: September 01, 2010, 08:40:49 AM »
Demo pls

Offline MrAndrew

  • Sr. Member
  • ****
  • Posts: 302
    • View Profile
    • Aviation PhotoBase
Re: [MOD] One photo big, and other small
« Reply #11 on: September 01, 2010, 09:40:32 AM »
Benny see attach, pls, in my first post. It sort images by rating. Big thumb with most rating

V@no, why this dublicate thumbnails?

Code: [Select]
<?php

$msmonth_images 
time() - 60 60 24 31;

$imgtable_width ceil(intval($config['image_table_width']) / $config['image_cells']);
if ((
substr($config['image_table_width'], -1)) == "%") {
  
$imgtable_width .= "%";
}

$additional_sql "";
if (!empty(
$additional_image_fields)) {
  foreach (
$additional_image_fields as $key => $val) {
    
$additional_sql .= ", i.".$key;
  }
}

$sql "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits".$additional_sql.", c.cat_name".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 c.cat_id = i.cat_id AND i.image_date >= " 
$msmonth_images " AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat""NOTIN").")
        ORDER BY i.image_hits DESC
        LIMIT 3"
;
        
$result $site_db->query($sql);
$num_rows $site_db->get_numrows($result);

if (!
$num_rows)  {
  
$msmonth_new_images "<table align=\"center\" width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\"><tr class=\"imagerow1\"><td>";
  
$msmonth_new_images .= $lang['no_today_images'];
  
$msmonth_new_images .= "</td></tr></table>";
}
else  {
  
$msmonth_new_images "<table align=\"center\" width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\">";
  
$count 0;
  
$bgcounter 0;
  while (
$image_row $site_db->fetch_array($result)) {
    
$row_bg_number = ($bgcounter++ % == 0) ? 2;

    
$msmonth_new_images .= "<td width=\"".$imgtable_width."\" align=\"center\" >";

    
show_image($image_row);

    
$site_template->register_vars("msmonth_images_type", ($count)); //is $count > 0 ?
    
$msmonth_new_images .= $site_template->parse_template("msmonth_image");
    
$msmonth_new_images .= "</td>";
    
$msmonth_new_images .= "</tr>";
    
$count++;
  } 
// end while
  
$msmonth_new_images .= "</table>";
}  
// end else

$site_template->register_vars("msmonth_images"$msmonth_new_images);
unset(
$msmonth_new_images);
?>

result:


Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] One photo big, and other small
« Reply #12 on: September 01, 2010, 02:44:46 PM »
Since you've changed the tag name, did you replace msrates with msmonth in the templates?
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline MrAndrew

  • Sr. Member
  • ****
  • Posts: 302
    • View Profile
    • Aviation PhotoBase
Re: [MOD] One photo big, and other small
« Reply #13 on: September 01, 2010, 02:51:30 PM »
V@no, I'm not careful. Big sorry. Topic completed. Fully worked!

Offline fermachado

  • Jr. Member
  • **
  • Posts: 92
    • View Profile
Re: [MOD] One photo big, and other small
« Reply #14 on: November 10, 2010, 08:11:40 AM »
Thanks, :D

works very nice.

I have  litle problem with de big thumbnail ,just show the normal thumbnail.

I use this Mod: Thumbnail exact size and border style(color rollover etc) ?? [square thumbnails]

http://www.4homepages.de/forum/index.php?topic=20353.msg111341#msg111341

Maybe the problem are here! Can you help me... :?

Thanks
Fernando
www.globalfoto.net

Sintra - Portugal