Hi all,
i would like to let you know about my solution integrating www.fitstadium.com and cloudflare services.
While most of Elgg JS and CSS are already compatible with cloudflare caching systems, for the
images that was not immediately done. I discovered on the cloudflare website that they cache file
by their extension. But elgg doesn't insert extension on images (like profile avatar, group avatar),
but generate a generic url like
( http://www.fitstadium.com/avatar/view/dbrighi/small/1364379495 ).
So i made a plugin hook to add the extension even to the profile and group avatar to add the extension
".jpg" at the end of the string, and now even the profile images (so important and resource and bandwidth consuming in a social network) now will be offered by CloudFlare server infrastructure.
I would like to share this little trick, maybe someone else already did it, but i didn't find it nowhere else.
Great work guys, go on!
Thank you so much
Denis Brighi
FitStadium Team
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by RaĆ¼l Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
- ura soul@tunist
ura soul - 0 likes
- dbrighi@dbrighi
dbrighi - 0 likes
- ura soul@tunist
ura soul - 0 likes
- Darth Vader@aminohappo
Darth Vader - 0 likes
You must log in to post replies.interesting, thanks for sharing. is the code available somewhere online? github maybe?
I wrote this code into start.php of one of my main plugin (inside the init function):
elgg_register_plugin_hook_handler('entity:icon:url', 'user', 'user_icon_url_override');
and the i copy/pasted the original function and modied into:
function user_icon_url_override($hook, $type, $returnvalue, $params) {
$user = $params['entity'];
$size = $params['size'];
if (isset($user->externalPhoto)) {
// return thumbnail
return $user->externalPhoto;
} else {
if (isset($user->icontime)) {
return "avatar/view/$user->username/$size/$user->icontime.jpg";
} else {
return "_graphics/icons/user/default{$size}.gif";
}
}
}
awesome thanks. i just activated this on my site too. thanks for sharing. :)
Does this neat trick work also on 1.9?