コード例 #1
0
/**
 * Set up the constants we need for avatar support.
 */
function bp_core_set_avatar_constants()
{
    $bp = buddypress();
    if (!defined('BP_AVATAR_THUMB_WIDTH')) {
        define('BP_AVATAR_THUMB_WIDTH', 100);
    }
    if (!defined('BP_AVATAR_THUMB_HEIGHT')) {
        define('BP_AVATAR_THUMB_HEIGHT', 100);
    }
    if (!defined('BP_AVATAR_FULL_WIDTH')) {
        define('BP_AVATAR_FULL_WIDTH', 150);
    }
    if (!defined('BP_AVATAR_FULL_HEIGHT')) {
        define('BP_AVATAR_FULL_HEIGHT', 150);
    }
    if (!defined('BP_AVATAR_ORIGINAL_MAX_WIDTH')) {
        define('BP_AVATAR_ORIGINAL_MAX_WIDTH', 450);
    }
    if (!defined('BP_AVATAR_ORIGINAL_MAX_FILESIZE')) {
        define('BP_AVATAR_ORIGINAL_MAX_FILESIZE', bp_attachments_get_max_upload_file_size('avatar'));
    }
    if (!defined('BP_SHOW_AVATARS')) {
        define('BP_SHOW_AVATARS', bp_get_option('show_avatars'));
    }
}
コード例 #2
0
 /**
  * The constuctor
  *
  * @since 2.4.0
  */
 public function __construct()
 {
     // Allowed cover image types & upload size
     $allowed_types = bp_attachments_get_allowed_types('cover_image');
     $max_upload_file_size = bp_attachments_get_max_upload_file_size('cover_image');
     parent::__construct(array('action' => 'bp_cover_image_upload', 'file_input' => 'file', 'original_max_filesize' => $max_upload_file_size, 'base_dir' => bp_attachments_uploads_dir_get('dir'), 'required_wp_files' => array('file', 'image'), 'upload_error_strings' => array(11 => sprintf(__('That image is too big. Please upload one smaller than %s', 'buddypress'), size_format($max_upload_file_size)), 12 => sprintf(_n('Please upload only this file type: %s.', 'Please upload only these file types: %s.', count($allowed_types), 'buddypress'), self::get_cover_image_types($allowed_types)))));
 }