4images Forum & Community
4images Modifications / Modifikationen => Mods & Plugins (Requests & Discussions) => Topic started by: MrAndrew 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 (http://skyphotos.ru) (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:
<?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++ % 2 == 0) ? 1 : 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:
include(ROOT_PATH.'global.php');
Add after:
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)) ? "&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.
LIMIT 4";
- It will show 4 images
2.
You can set how sort you top.
ORDER BY i.image_rating DESC
Change this part to change sort what you want. I.E. i.image_hits ....
DEMO:
In my gallery this MOD show as: see attach
-
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++ % 2 == 0) ? 1 : 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
{ifno msrates_images_type}{thumbnail_big}{endifno msrates_images_type}{if msrates_images_type}{thumbnail_small}{endif msrates_images_type}
-
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!
-
Replace
$msrates_new_images .= "</tr>";
With this:
if (!$count)
{
$msrates_new_images .= "</tr>";
}
-
V@no, i`m sorry.. :cry: this give me next result:
All is good, but not together :(
-
replace
$msrates_new_images .= "<td width=\"".$imgtable_width."\" align=\"center\" >";
with:
$msrates_new_images .= "<td width=\"".$imgtable_width."\" align=\"center\"" . (!$count ? 'colspan="2"' : '') .">";
-
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
<?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++ % 2 == 0) ? 1 : 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);
?>
-
Are you saying it shows wrong thumbnails?
P.S.
Ever tried use PrintScreen button and an image editor (MS Paint)? ;)
-
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
-
It's because you are not using the code I've posted.
-
Demo pls
-
Benny see attach, pls, in my first post. It sort images by rating. Big thumb with most rating
V@no, why this dublicate thumbnails?
<?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++ % 2 == 0) ? 1 : 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:
-
Since you've changed the tag name, did you replace msrates with msmonth in the templates?
-
V@no, I'm not careful. Big sorry. Topic completed. Fully worked!
-
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
-
New version released! See first post!