- Timestamp:
- 12/06/11 01:14:30 (6 months ago)
- Location:
- trunk
- Files:
-
- 2 edited
-
common/avatar.php (modified) (1 diff)
-
scripts/make-avatar-folder (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/common/avatar.php
r1155 r1156 21 21 'L50x50' => 'normal/' , '75x75'=> 'forum/', '150x150' => 'big/'); 22 22 23 // Copying the original image 24 copy($filepath, IA_AVATAR_FOLDER.'full/'.$new_filename); 23 // Hardlink / Copy the original image 24 $new_filepath = IA_AVATAR_FOLDER . 'full/' . $new_filename; 25 if (is_file($new_filepath) || is_link($new_filepath)) { 26 unlink($new_filepath); 27 } 28 if (!link($filepath, $new_filepath)) { 29 if (!copy($filepath, $new_filepath)) { 30 log_error('Unable to copy user avatar into avatar folder'); 31 } 32 } 25 33 26 34 list($image_width, $image_height, $image_type, $image_attribute) = -
trunk/scripts/make-avatar-folder
r1155 r1156 2 2 <?php 3 3 4 require_once(dirname($argv[0]) ."/utilities.php");5 require_once(IA_ROOT_DIR .'common/db/db.php');6 require_once(IA_ROOT_DIR .'www/controllers/attachment.php');7 require_once(IA_ROOT_DIR .'www/controllers/image_attachment.php');8 require_once(IA_ROOT_DIR .'common/db/attachment.php');9 require_once(IA_ROOT_DIR .'common/cache.php');10 require_once(IA_ROOT_DIR .'common/db/user.php');11 require_once(IA_ROOT_DIR .'common/avatar.php');12 require_once(IA_ROOT_DIR .'common/db/textblock.php');4 require_once(dirname($argv[0]) . '/utilities.php'); 5 require_once(IA_ROOT_DIR . 'common/db/db.php'); 6 require_once(IA_ROOT_DIR . 'www/controllers/attachment.php'); 7 require_once(IA_ROOT_DIR . 'www/controllers/image_attachment.php'); 8 require_once(IA_ROOT_DIR . 'common/db/attachment.php'); 9 require_once(IA_ROOT_DIR . 'common/cache.php'); 10 require_once(IA_ROOT_DIR . 'common/db/user.php'); 11 require_once(IA_ROOT_DIR . 'common/avatar.php'); 12 require_once(IA_ROOT_DIR . 'common/db/textblock.php'); 13 13 14 14 // Database connect 15 15 db_connect(); 16 $verbose = getattr($argv, 1, false) === '-v'; 16 17 17 18 // Managing the userinfo template from the textblock table 18 if (read_bool( "Do you want to change the template/userinfo textblock?",19 if (read_bool('Do you want to change the template/userinfo textblock?', 19 20 false)) { 20 21 $textfortextblock = "table(compact). |=/5. ==UserImage". … … 28 29 "\r\n\r\n\r\n"; 29 30 textblock_add_revision('template/userinfo', 'template/userinfo', 30 $textfortextblock, 1, "protected");31 $textfortextblock, 1, 'protected'); 31 32 } 32 33 … … 40 41 if (file_exists(IA_AVATAR_FOLDER) == false) { 41 42 mkdir(IA_AVATAR_FOLDER, 0777); 42 $size_types = array("tiny", "small", "normal", "forum", "big", "full"); 43 foreach ($size_types as $size) { 44 if (file_exists(IA_AVATAR_FOLDER."/".$size) == false) {45 mkdir(IA_AVATAR_FOLDER."/".$size, 0777);46 }43 } 44 $size_types = array('tiny', 'small', 'normal', 'forum', 'big', 'full'); 45 foreach ($size_types as $size) { 46 if (file_exists(IA_AVATAR_FOLDER . '/' . $size) == false) { 47 mkdir(IA_AVATAR_FOLDER . '/' . $size, 0777); 47 48 } 48 49 } … … 54 55 // Going through all the users 55 56 foreach ($userlist as $user) { 56 $attach = attachment_get('avatar', 'utilizator/'.$user); 57 if (!is_user_name($user)) { 58 log_warn('Invalid username: ' . $user); 59 continue; 60 } 61 $attach = attachment_get('avatar', 'utilizator/' . $user); 57 62 $found = !is_null($attach); 58 63 … … 60 65 $real_name = attachment_get_filepath($attach); 61 66 $found = file_exists($real_name); 62 if (!$found) 63 log_warn("File does not exists but it is in the Database."); 67 if (!$found) { 68 log_warn('File does not exists but it is in the Database.'); 69 } 64 70 } 65 71 … … 74 80 75 81 // The user has a valid image, resizing it, but keeping the attachment 82 if ($verbose) { 83 log_print('Processing user: ' . $user); 84 } 76 85 avatar_cache_resized($real_name, $img_info, "a".$user); 77 86 }
Note: See TracChangeset
for help on using the changeset viewer.
![[infoarena] development](/chrome/site/logo.png)