4images Forum & Community
Welcome, Guest. Please login or register.
Did you miss your activation email?
August 19, 2018, 09:40:07 PM

Login with username, password and session length
Search:     Advanced search
Togle to toolbar
Translate this page with =>
Translate this page >
* Home Help Search Login Register
 
+  4images Forum & Community
|-+  4images Modifications / Modifikationen
| |-+  Mods & Plugins (Releases & Support) (Moderators: mawenzi, Rembrandt)
| | |-+  [Mod] Different Thumbnail sizes
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] 2 » »» Print
Current Topic Rating: *****
Author Topic: [Mod] Different Thumbnail sizes  (Read 19940 times)
Rembrandt
Moderator
4images Guru
*****
Offline Offline

Posts: 4187

Thank You
-Given: 116
-Receive: 899

Vienna


View Profile WWW
« on: August 20, 2012, 04:21:38 PM »

 Hi!

 - one function for all different Thumbnail sizes
 - the new thumbnails can be smaller or larger than the original thumbnails.
 - Side ratio is respected
 
1.) search in includes/functions.php:
 
1
2
 function get_thumbnail_code($media_file_name$thumb_file_name ""$image_id$cat_id$image_name ""$mode ""$show_link 1$open_window 0) {
 
insert above:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//########### Start [Mod] Different Thumbnail sizes ############################
function get_thumbnail_resizer($media_file_name$thumb_file_name ""$image_id$cat_id$image_name ""$mode ""$show_link 1$open_window 0$new_width ""$new_height ""$contest 0) {
  global 
$site_sess$config$site_template;
   
  
$new_width $new_width $new_width $config['max_thumb_width'];
  
$new_height $new_height $new_height $config['max_thumb_height'];
  
$orig_file = ($new_width>$config['max_thumb_width'] || $new_height>$config['max_thumb_height']) ? "media" "thumb";
  
  if (!
check_media_type($media_file_name)) {
    
$new_image "<img src=\"".ICON_PATH."/404.gif\" border=\"0\" alt=\"\" >";
  }
  else {
    if (!
get_file_path($thumb_file_name"thumb"$cat_id00)) {
      
$file_src ICON_PATH."/".get_file_extension($media_file_name).".gif";
      
$image_info = @getimagesize($file_src);
       
$orig_width $image_info[0];
       
$orig_height $image_info[1];
       
$new_image "<img src=\"".$file_src."\" style=\"border:0px;width:".$orig_width."px; height:".$orig_height."px;\" alt=\"".format_text($image_name2)."\" >";
    }
    else {
      
$file_src get_file_path($media_file_name$orig_file$cat_id01);
      
$orig_file = (check_thumb_type($file_src)) ?  $orig_file "thumb";

      
$file_src get_file_path($thumb_file_name$orig_file$cat_id01);
      
$image_info = @getimagesize($file_src);
      
$orig_width $image_info[0];
      
$orig_height $image_info[1];

      if(
$new_width<$orig_width || $new_height<$orig_height){
        
$orig_ratio $orig_width $orig_height;
        if (
$new_width $new_height $orig_ratio){
          
$new_width round($new_height $orig_ratio);
        }
        else{
          
$new_height round($new_width/$orig_ratio);
        }
      }
      else{
        
$new_width $orig_width;
        
$new_height $orig_height;
      }
       
$new_image "<img src=\"".$file_src."\" style=\"border:".$config['image_border']."px solid; width:".$new_width."px; height:".$new_height."px;\" alt=\"".format_text($image_name2)."\">";    
    }
  }
  if (
$show_link) {
    if (
$open_window) {
      
$new_image "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id.((!empty($mode)) ? "&amp;mode=".$mode ""))."\" onclick=\"opendetailwindow()\" target=\"detailwindow\">".$new_image."</a>";         
    }
    else {
      
$new_image "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id.((!empty($mode)) ? "&amp;mode=".$mode ""))."\">".$new_image."</a>";
    }
  }
  return 
$new_image;
}
//########### End [Mod] Different Thumbnail sizes ############################

2.) search in includes/functions.php:
1
    "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 below so many rows as you need, example:
1
2
3
4
5
    "thumbnail_small" => get_thumbnail_resizer($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,050,50), // The last two values are "width, height"
    
"thumbnail_medium" => get_thumbnail_resizer($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,0110,110), // The last two values are "width, height"
    
"thumbnail_large" => get_thumbnail_resizer($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,0200,200), // The last two values are "width, height"
    
"thumbnail_big" => get_thumbnail_resizer($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,0400,400), // The last two values are "width, height"
    //e.t.c.

mfg Andi
« Last Edit: September 18, 2012, 07:56:01 AM by Rembrandt » Logged

Meine 4Images Modifikationen  Now over 100 Modification Online!    Meine 4images Demo Seite


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)
paule
Jr. Member
**
Offline Offline

Posts: 64

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #1 on: August 20, 2012, 05:17:26 PM »

Hi Andi,

Perfekt!!
Du bist der Beste!!!!!

Vielen Dank

paulchen
Logged
paule
Jr. Member
**
Offline Offline

Posts: 64

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #2 on: September 02, 2012, 05:20:35 PM »

Hallo Andi,

nur zur Info.
Es funktioniert wieder.
Sorry für die Umstände.
Es war wohl ein Cache Problem bei 2 Rechnern….
Hab ich noch nie gehabt.

noch mal vielen Dank für die Mühe.

paulchen
Logged
Rembrandt
Moderator
4images Guru
*****
Offline Offline

Posts: 4187

Thank You
-Given: 116
-Receive: 899

Vienna


View Profile WWW
« Reply #3 on: September 02, 2012, 05:27:22 PM »

NP, Hauptsache es funktioniert wieder...

mfg Andi
Logged

Meine 4Images Modifikationen  Now over 100 Modification Online!    Meine 4images Demo Seite


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)
niad
Jr. Member
**
Offline Offline

Posts: 80

Thank You
-Given: 31
-Receive: 2


View Profile
« Reply #4 on: September 17, 2012, 06:09:15 PM »

Great MOD!
But there is a problem when a member is uploading a zip file and not an image.
In this case the MOD doesn't change the uploaded thumbnail image and the worst, doesn't let the thumb appear

Any solution for this case please  Embarassed
Logged

I love 4images, it is really great work!
Rembrandt
Moderator
4images Guru
*****
Offline Offline

Posts: 4187

Thank You
-Given: 116
-Receive: 899

Vienna


View Profile WWW
« Reply #5 on: September 17, 2012, 06:47:34 PM »

Hi!

Thank you for the hint!

test it please:
search in the code:
1
if (!get_file_path($media_file_name$orig_file$cat_id00)) {
and replace:
1
if (!get_file_path($media_file_name"thumb"$cat_id00)) {

and please give me a Feedback, thx.

mfg Andi
Logged

Meine 4Images Modifikationen  Now over 100 Modification Online!    Meine 4images Demo Seite


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)
niad
Jr. Member
**
Offline Offline

Posts: 80

Thank You
-Given: 31
-Receive: 2


View Profile
« Reply #6 on: September 17, 2012, 07:37:40 PM »

Hi Andi,
After the change you suggested I get this instead of the real preview...
Of course it is better, but doesn't fix the preview problem...
 
Logged

I love 4images, it is really great work!
Rembrandt
Moderator
4images Guru
*****
Offline Offline

Posts: 4187

Thank You
-Given: 116
-Receive: 899

Vienna


View Profile WWW
« Reply #7 on: September 17, 2012, 07:40:44 PM »

I have already noticed....
I am looking for a solution....

mfg Andi
Logged

Meine 4Images Modifikationen  Now over 100 Modification Online!    Meine 4images Demo Seite


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)
niad
Jr. Member
**
Offline Offline

Posts: 80

Thank You
-Given: 31
-Receive: 2


View Profile
« Reply #8 on: September 17, 2012, 07:46:13 PM »

wow! Thanks, you are so kind and helpful!
Logged

I love 4images, it is really great work!
Rembrandt
Moderator
4images Guru
*****
Offline Offline

Posts: 4187

Thank You
-Given: 116
-Receive: 899

Vienna


View Profile WWW
« Reply #9 on: September 18, 2012, 07:59:20 AM »

so.. I have updated step 1.) in my first post.
For me works it, i hope for you too. Smile

mfg Andi
Logged

Meine 4Images Modifikationen  Now over 100 Modification Online!    Meine 4images Demo Seite


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)
niad
Jr. Member
**
Offline Offline

Posts: 80

Thank You
-Given: 31
-Receive: 2


View Profile
« Reply #10 on: September 18, 2012, 12:21:12 PM »

It works great! Thank you so much!  Very Happy
Logged

I love 4images, it is really great work!
Rembrandt
Moderator
4images Guru
*****
Offline Offline

Posts: 4187

Thank You
-Given: 116
-Receive: 899

Vienna


View Profile WWW
« Reply #11 on: September 18, 2012, 12:59:21 PM »

np... Smile

mfg Andi
Logged

Meine 4Images Modifikationen  Now over 100 Modification Online!    Meine 4images Demo Seite


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)
Tiburon
Jr. Member
**
Offline Offline

Posts: 85

Thank You
-Given: 14
-Receive: 2


View Profile WWW
« Reply #12 on: September 19, 2012, 09:05:34 AM »

First of all, thank you for this mod. It works fine with 1.7.11 and I love it.

I have only one question regarding the top lists. Normally I call an image preview/thumbnail on my toplist like this:

1
{image_downloads_thumb_xx}

After installing the mod there is no longer a thumbnail but a link. How do I manage it, that the small thumbnail is shown on toplist? I tried it like this:

1
{image_downloads_thumb_small_1}
or
1
{image_downloads_thumbnail_small_1}

but this doesn´t work. Do you have any idea how it can work, or does it need further changes in the code to show thumbnails on toplists after installing the mod?

vg Tiburon
Logged

----------------------------------

Have a nice Day
Rembrandt
Moderator
4images Guru
*****
Offline Offline

Posts: 4187

Thank You
-Given: 116
-Receive: 899

Vienna


View Profile WWW
« Reply #13 on: September 19, 2012, 05:51:10 PM »

post your top.php...
Logged

Meine 4Images Modifikationen  Now over 100 Modification Online!    Meine 4images Demo Seite


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)
Tiburon
Jr. Member
**
Offline Offline

Posts: 85

Thank You
-Given: 14
-Receive: 2


View Profile WWW
« Reply #14 on: September 20, 2012, 10:11:13 AM »

Hi Rembrandt,

thanks for answering. It was my mistake. After upgrading to 1.7.11 I forgot to change the original top.php file with my modified one. Embarassed Your mod also works perfectly with a modified toplist. Sorry if I caused any inconvenience.

Tiburon
Logged

----------------------------------

Have a nice Day
Pages: [1] 2 » »» Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.054 seconds with 20 queries.