Changeset 12732 for extensions/GThumb/functions.inc.php
- Timestamp:
- Dec 14, 2011, 1:32:52 PM (12 years ago)
- File:
-
- 1 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
Note: See TracChangeset
for help on using the changeset viewer.