How to change user avatar using REST API?
How to change user avatar using REST API?
How to change user avatar using REST API?
The easiest way to do that would be to inline some CSS in your php template. then you could replace that hardcoded image URL with the users avatar like background-image: url(“‘ . echo $avatarURL . “); You will definitely need to fix your snippet to get the avatar as well though. currently you’re returning the … Read more
I figured this out. The server I am working on doesn’t have access to the outside. So, even though the image is in my template folder, the gravatar.com call in front of the image path was causing the error.
Just generate the URL yourself. It’s just a hash of the user’s email address. function get_gravatar_url( $email ) { $hash = md5( strtolower( trim ( $email ) ) ); return ‘http://gravatar.com/avatar/’ . $hash; } This function requires that you pass the user’s email address in … but you could do anything you need to programatically … Read more
It depends on what you call “nice” of course – it’s hard to create something meaningful with an algorithm. Someone once created a unicorn-generator, which was used on April 1, 2010 all over Stack Overflow. Your unicorn looks like this:
As far as I know the get_avatar() function only allows for square values. That doesn’t mean you couldn’t use styling to display a rectangular avatar. Essentially you would use styling to “shave off” 150px from the width. So, let’s assume that your theme file produces a 300 x 300 pixel avatar for the post author … Read more
If you go to http://gravatar.com/d6b10d5767d1e29006c11e1a2c590f3c (omit the /avatar/ from path) you get http://gravatar.com/clojita which seems to be your gravatar account, correct? MD5 collision is unlikely (but maybe it’s time to buy a lottery ticket 🙂 Look at source fetches interesting detail — the comment in question has comment-author-clark class. So it’s not only the gravatar … Read more
The filters you cite are only for the default/fallback avatars. If you want to replace BP avatars altogether, the key filters are bp_core_fetch_avatar and bp_core_fetch_avatar_url. The latter filters the entire HTML avatar element, while the latter does just the URL. How you do the filtering depends on how fancy you want to get. The bp_core_fetch_avatar … Read more
You have the Photon module enabled in the Jetpack plugin. That module routes your images through WordPress.com’s CDN. If you don’t want this to happen, disable the Photon module in Jetpack.
Unfortunately at moment Gravatar service itself only accepts single number for size and only serves square images. So you have to achieve it with CSS or download, modify and cache images.