Name | Update Time |
Netflix | September 6, 2024 9:17 am |
Disney+ | September 6, 2024 10:56 am |
Max | September 6, 2024 11:15 am |
ChatGPT 4 | September 4, 2024 4:23 pm |
Spotify | September 6, 2024 2:30 pm |
Prime Video | September 6, 2024 2:55 pm |
Codecademy | September 6, 2024 2:40 pm |
Grammarly | September 3, 2024 1:46 pm |
Canva Pro | September 5, 2024 2:52 pm |
Udemy Premium Cookies | September 2, 2024 2:53 pm |
In order to improve the user experience, I thought of caching the commenter’s avatar locally. Most of the avatar files are in png format. I tried to delete all cached avatars and re-cache them. After refreshing, the avatars can be displayed normally. The following is the cached avatar code:
function fa_cache_avatar($avatar, $id_or_email, $size, $default, $alt)
{
$avatar = str_replace(array(“www.gravatar.com”, “0.gravatar.com”, “1.gravatar.com”, “2.gravatar.com”), “cn.gravatar.com”, $avatar);
$tmp = strpos($avatar, ‘http’);
$url = get_avatar_url( $id_or_email, $size ) ;
$url = str_replace(array(“www.gravatar.com”, “0.gravatar.com”, “1.gravatar.com”, “2.gravatar.com”), “cn.gravatar.com”, $url);
$avatar2x = get_avatar_url( $id_or_email, ( $size * 2 ) ) ;
$avatar2x = str_replace(array(“www.gravatar.com”, “0.gravatar.com”, “1.gravatar.com”, “2.gravatar.com”), “cn.gravatar.com”, $avatar2x);
$g = substr($avatar, $tmp, strpos($avatar, “‘”, $tmp) – $tmp);
$tmp = strpos($g, ‘avatar/’) + 7;
$f = substr($g, $tmp, strpos($g, “?”, $tmp) – $tmp);
$w = home_url();
$e = ABSPATH .’avatar/’. $size . ‘*’. $f .’.jpg’;
$e2x = ABSPATH .’avatar/’. ( $size * 2 ) . ‘*’. $f .’.jpg’;
$t = 1209600;
if ( (!is_file($e) || (time() – filemtime($e)) > $t) && (!is_file($e2x) || (time() – filemtime($e2x)) > $t ) ) {
copy(htmlspecialchars_decode($g), $e);
copy(htmlspecialchars_decode($avatar2x), $e2x);
} else { $avatar = $w.’/avatar/’. $size . ‘*’.$f.’.jpg’;
$avatar2x = $w.’/avatar/’. ( $size * 2) . ‘*’.$f.’.jpg’;
if (filesize($e) < 1000) copy($w.’/avatar/default.jpg’, $e);
if (filesize($e2x) < 1000) copy($w.’/avatar/default.jpg’, $e2x);
$avatar = “{$alt}”;
}
return $avatar;
}
add_filter(‘get_avatar’, ‘fa_cache_avatar’,1,5);
Search
Popular on Blogar
Email Marketing-What Is Email Marketing?
- October 24th, 2023
- 907 Views
2024 Codecademy Premium Account Cookies
- September 6th, 2024
- 1169 Views
2024 Grammarly Premium Account Cookies
- September 3rd, 2024
- 2044 Views
2024 ChatGPT 4 Premium Account Free Cookies
- September 4th, 2024
- 1999 Views
2024 Canva Pro Free Team Invite Link And Cookies
- September 5th, 2024
- 3376 Views
Perplexity AI Premium Cookies 2024
- April 17th, 2024
- 1186 Views
Content Marketing-What is Content Marketing
- October 24th, 2023
- 1188 Views
Social Media Marketing-Social Media Marketing (SMM)
- October 24th, 2023
- 1346 Views
Pay-Per-Click-What is PPC
- October 24th, 2023
- 1066 Views
WordPress displays subcategories of the current category
- July 16th, 2024
- 93 Views
How To Find The IP Of Any Whatsapp Call
- September 3rd, 2024
- 9 Views
Gmail Account Generation Method #1
- September 4th, 2024
- 9 Views
Install Google Tag Manager on your website
- July 23rd, 2024
- 84 Views
2024 Spotify Premium Account Cookies
- September 6th, 2024
- 829 Views
How to Create a Blog Page on WordPress
- July 19th, 2024
- 82 Views
Recent Post
2024 Codecademy Premium Account Cookies
- September 6th, 2024
- 1169 Views
2024 Grammarly Premium Account Cookies
- September 3rd, 2024
- 2044 Views
2024 ChatGPT 4 Premium Account Free Cookies
- September 4th, 2024
- 1999 Views
2024 Canva Pro Free Team Invite Link And Cookies
- September 5th, 2024
- 3376 Views
Perplexity AI Premium Cookies 2024
- April 17th, 2024
- 1186 Views
Email Marketing-What Is Email Marketing?
- October 24th, 2023
- 907 Views
Content Marketing-What is Content Marketing
- October 24th, 2023
- 1188 Views
Social Media Marketing-Social Media Marketing (SMM)
- October 24th, 2023
- 1346 Views
Pay-Per-Click-What is PPC
- October 24th, 2023
- 1066 Views
Gmail Account Generation Method #1
- September 4th, 2024
- 9 Views
More Post
- Howo Tractor Truck
- Howo Tipper/Dump Truck
- Howo Cargo Truck
- Howo Concrete Mixer Truck
- Howo Special Truck
- Howo Light Truck
- Shacman Tractor Truck
- Shacman Tipper/Dump Truck
- Shacman Cargo Truck
- Shacman Concrete Mixer Truck
- LGMG Mining Trucks
- XCMG Wheel Loader
- XCMG Excavator
- XCMG Crane
- XCMG Asphalt Pavers
- XCMG Road Roller
- Shantui Bulldozer
Copyright © 2024 BBBBF All Rights Reserved.