thumbnailFromUserId() static public méthode

Catalog image is stored in user's active Media Library.
static public thumbnailFromUserId ( integer $user_id, string $size ) : string
$user_id integer
$size string
Résultat string
/**
 * Get catalog logo
 *
 * @param array $profile
 *
 * @return string
 */
function _logo_url($profile)
{
    if (empty($profile['pb_catalog_logo'])) {
        return PB_PLUGIN_URL . 'assets/images/default-book-cover-100x100.jpg';
    } elseif (PB_Image\is_default_cover($profile['pb_catalog_logo'])) {
        return PB_PLUGIN_URL . 'assets/images/default-book-cover-100x100.jpg';
    } else {
        return PB_Catalog::thumbnailFromUserId($profile['users_id'], 'thumbnail');
    }
}
Exemple #2
0
/**
 * Render "Catalog Logo" meta box
 *
 * @param int $user_id
 */
function catalog_logo_box($user_id)
{
    $meta_key = 'pb_catalog_logo';
    $image_url = \PressBooks\Catalog::thumbnailFromUserId($user_id, 'pb_cover_medium');
    $action = 'pb_delete_catalog_logo';
    $nonce = wp_create_nonce('pb-delete-catalog-logo');
    render_cover_image_box($meta_key, absint($user_id), $image_url, $action, $nonce);
}