Changeset 12858


Ignore:
Timestamp:
01/06/12 17:14:52 (8 years ago)
Author:
patdenice
Message:

Allow to add personal thumbnails for GThumb display.
Don't generate thumbnail if original thumbnail have the correct size.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/GThumb/main.inc.php

    r12857 r12858  
    164164  } 
    165165 
     166  if ( !empty( $picture['tn_ext'] ) ) 
     167  { 
     168    $file = substr_replace(get_filename_wo_extension($picture['path']), '/GThumb/',strrpos($picture['path'],'/'),1).'.'.$picture['tn_ext']; 
     169    if (file_exists($file)) 
     170    { 
     171      list($width, $height) = getimagesize($file); 
     172 
     173      $result = array( 
     174        'src' => embellish_url(get_root_url().$file), 
     175        'width' => $width, 
     176        'height' => $height, 
     177      ); 
     178    } 
     179  } 
     180 
    166181  $width = $picture['width']; 
    167182  $height = $picture['height']; 
     
    182197  $result = pwg_image::get_resize_dimensions($width, $height, 5000, $new_height); 
    183198  $result['src'] = ''; 
     199 
     200  // Test thumbnail size 
     201  list($width, $height) = getimagesize(get_thumbnail_path($picture)); 
     202  if ($result['width'] == $width and $result['height'] == $height) 
     203  { 
     204    $result['src'] = get_thumbnail_url($picture); 
     205  } 
     206 
    184207  $result['use_high'] = $use_high; 
    185208  $result['cache_path'] = GTHUMB_CACHE_DIR.'/'.$new_height.'/'; 
Note: See TracChangeset for help on using the changeset viewer.