Changeset 12732 for extensions/GThumb
- Timestamp:
- Dec 14, 2011, 1:32:52 PM (12 years ago)
- Location:
- extensions/GThumb
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/GThumb/functions.inc.php
r12705 r12732 41 41 if (empty($data['src'])) 42 42 { 43 $cache_dir = GTHUMB_CACHE_DIR.'/'; 44 if ($params['size'] == 'small' or $conf['GThumb']['cache_big_thumb']) 45 { 46 $cache_dir = $data['cache_path']; 47 } 48 $file = $cache_dir.'/'.md5($picture['path'].(!empty($picture['md5sum']) ? $picture['md5sum'] : '')).'.'.$picture['tn_ext']; 49 50 if (!is_dir($cache_dir)) 51 { 52 mkgetdir($cache_dir, MKGETDIR_DEFAULT&~MKGETDIR_DIE_ON_ERROR); 53 if (!is_writable($cache_dir)) 54 { 55 die("Give write access (chmod 777) to $cache_dir directory at the root of your Piwigo installation"); 56 } 57 } 58 59 $filepath = $picture['path']; 60 if ($data['use_high']) 61 { 62 include_once(PHPWG_ROOT_PATH.'admin/include/functions_upload.inc.php'); 63 $filepath = file_path_for_type($filepath, 'high'); 64 } 65 $img = new pwg_image($filepath); 66 $result = $img->pwg_resize($file, $data['width'], $data['height'], $conf['upload_form_thumb_quality'], false, true, ($params['size'] == 'big'), false); 67 $img->destroy(); 43 $result = make_gthumb_image($picture, $data); 44 $file = $result['destination']; 68 45 } 69 46 else … … 104 81 'height' => $result['height'], 105 82 ); 83 } 84 85 function make_gthumb_image($picture, $data) 86 { 87 global $conf; 88 89 $cache_dir = GTHUMB_CACHE_DIR.'/'; 90 if ($data['size'] == 'small' or $conf['GThumb']['cache_big_thumb']) 91 { 92 $cache_dir = $data['cache_path']; 93 } 94 $file = $cache_dir.md5($picture['path'].(!empty($picture['md5sum']) ? $picture['md5sum'] : '')).'.'.$picture['tn_ext']; 95 96 if (!is_dir($cache_dir)) 97 { 98 mkgetdir($cache_dir, MKGETDIR_DEFAULT&~MKGETDIR_DIE_ON_ERROR); 99 if (!is_writable($cache_dir)) 100 { 101 die("Give write access (chmod 777) to $cache_dir directory at the root of your Piwigo installation"); 102 } 103 } 104 105 $filepath = $picture['path']; 106 if ($data['use_high']) 107 { 108 include_once(PHPWG_ROOT_PATH.'admin/include/functions_upload.inc.php'); 109 $filepath = file_path_for_type($filepath, 'high'); 110 } 111 $img = new pwg_image($filepath); 112 $result = $img->pwg_resize($file, $data['width'], $data['height'], $conf['upload_form_thumb_quality'], false, true, ($data['size'] == 'big'), false); 113 $img->destroy(); 114 115 return $result; 106 116 } 107 117 -
extensions/GThumb/main.inc.php
r12712 r12732 77 77 'height' => $ft['TN_HEIGHT'], 78 78 ); 79 79 80 if (empty($small_thumb['src'])) 80 81 { 81 $small_thumb['src'] = 'ws.php?method=pwg.images.getGThumbPlusThumbnail&image_id='.$small_thumb['id'].'&return=true'; 82 include_once(GTHUMB_PATH.'functions.inc.php'); 83 $data = get_gthumb_data($pictures[0]); 84 $result = make_gthumb_image($pictures[0], $data); 85 $small_thumb['src'] = $result['destination']; 82 86 } 83 87 … … 91 95 'height' => $data['height'], 92 96 ); 93 if (empty($ data['src']))97 if (empty($big_thumb['src'])) 94 98 { 95 $big_thumb['src'] = 'ws.php?method=pwg.images.getGThumbPlusThumbnail&image_id='.$ft['ID'].'&size=big&return=true'; 99 if ($conf['GThumb']['cache_big_thumb']) 100 { 101 include_once(GTHUMB_PATH.'functions.inc.php'); 102 $result = make_gthumb_image($pictures[0], $data); 103 $big_thumb['src'] = $result['destination']; 104 } 105 else 106 { 107 $big_thumb['src'] = 'ws.php?method=pwg.images.getGThumbPlusThumbnail&image_id='.$ft['ID'].'&size=big&return=true'; 108 } 96 109 } 97 110 … … 177 190 $result['use_high'] = $use_high; 178 191 $result['cache_path'] = GTHUMB_CACHE_DIR.'/'.$new_height.'/'; 192 $result['size'] = $size; 179 193 180 194 return $result;
Note: See TracChangeset
for help on using the changeset viewer.