Hi
I'm trying to figure out what file I would have to edit to create duplicate avatars when a user uploads a new avatar.
I would like a duplicate avatar to be placed in a custom dir eg: _graphics/custom_avatars.
If someone would be so kinds as to tell me what file/files I need to edit to achieve this it would be great.
thanks in advance
regards
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.
upload.php
Basically i need to pass a url to an external site so it can display an icon in the page which is loaded into an iframe, if i'd have installed into a subdir i would be able to pas it: http://mysite.com/subdir/datafolder
but i can't do that as far as i know, and i don't really want to give anybody/thing access to my elggdata dir. so the only way round it i can think of is to do this.
$uid ="$user->guid";
$avatar ="customname";
$url ="http://mysite.com/_graphics/custom_graphics/";
$customavatar ="$uid$avatar";
$avatar_url ="$url$customavatar";
............. '.$avatar_url.' ...............
and have the duplicate placed in http://mysite.com/_graphics/custom_graphics/
but I've just realised I forgotten about the image extention !!! dammit!!!
Oh well I guess we'll have to wait for a SSO games channel. I got the SSO working it's just the bloody image url, I have never wished i installed in a subdir so badly in my life!
thanks all the same anyway
delete another post
regards
whooaaaaaa hold the press!!!
apparently images are converted to.jpg :-D
Don't save uploaded content to publicly accessible directories. This is a huge security risk and is why Elgg doesn't allow the data dir to be in the www dir.
Why can't you just use the URL of the icon? For example, this is your icon URL for this site: http://community.elgg.org/mod/profile/icondirect.php?lastcache=1327263372&joindate=1292075298&guid=650970&size=large
@Brett
HI thanks for the reply, I've been trying to do that but I don't know how to do it. I'm new to elgg and php.
Basicall, I have created SSO for the games plugin which loads into an iframe.
I've tried using $avatar_url = $user->getIconURL('large'); (i've edited the upload.php to create a custom sized avatar) but the link is always broken.
I tried to print and echo to test the result but it always returns large (large) rather than a url similar to the one you posted
If you could help me out on this one it would be awesome!
Thanks in anticipation
Regards
Ahhhhhhhhhhhh I've noticed that in the url it has "lastcache=" I had my caches turned off - is that what's causing the problem with the links? As in no cached avatar there??
soon find out - well, tomorrow as I'm calling it a night
Thanks again for the advice
regards
Stumpy
1. If you created 'custom' icon sizes, you will need to edit the appropriate views to render the new icon size
2. Are you sure you haven't been experimenting with the core files? Sounds like you've introduced a bug of some sort
3. Use http_build_query
@IK
I've figured out how to get the currect url to pass to the external site, and I've figured out how to successfully use urlencode to encode the url as specified and the link is no longer broken, however now it is the default avatars that are showing rather than the user avatar. I've tried clearing the caches, and i've reversed the edit I did to upload.php.
So now I have to figure out how to 1) show the users' avatar, not the default avatar and 2) sort out a new problem I have which is creating the correct md5 hash (auth_id=md5(uid+channelkey).
Thanks muchly for the tip, I will now find out what the function of "http_build_query"is.
apart from that, Any suggestions on what to try next with points 1) & 2) would be awesome.
Thanks again
regards
I'm still confused about exactly what you're trying to do. If you just want your users' avatar URLs you need to use $user->getIconURL('master'). That returns the correct URL. That's how core does it. If the default icon is showing up it means one of the parameters that you're passing to the icon script is incorrect.
To add query strings to a URL, use elgg_http_add_url_query_elements($url, array('name' => 'value'));
@Brett
WHat I'm trying to do is upgrade 0nx5's games plugin (come2play iframe) to use SSO. I've managed to pass the rest of the essential matadata to the external server and it displays fine, I printed $avatar_url = $user->getIconURL('small') and it displayed a url in the same format as you example above, however it needed encoding. I did that and the broken link in the image place holder was replaced by the defaultsmall.gif.
I also get a "error invalid auth_id!" message, and I was wondering if, if the the auth wasn't valid, would that cause elgg to forward me to the _graphics/.../.../defaultsmall.gif instead of the user's avatar?
As a side note, are the images cached in a dir in the root?
thanks again for the help
regards
- Previous
- 1
- 2
- Next
You must log in to post replies.