Customizing SMF > Portals, Bridges, and Integrations

New tools to help integrating SMF with something else

<< < (26/27) > >>

Mystic83:
Hey all, I'm having difficulties using this API to get avatar data.

The avatar array doesn't seem to have anything useful in it for onsite avatars. The attachment id can't be used by any functions, as far as I can tell, and the the filename is incorrect. A little bit of poking around shows that on SMF, the attachments are loaded using the id, but I don't appear to be able to do that outside of those particular files. In addition, there is some hashing going on with regards to attachment names, which might explain why the filename is incorrect.

So what am I supposed to do with the data I'm given? I believe using SSI.php solves this problem, but because I need some of the things in the api, it seems silly to use both...

guzh:

--- Quote from: Mystic83 on October 11, 2012, 05:59:53 AM ---Hey all, I'm having difficulties using this API to get avatar data.

--- End quote ---
At least for my use, this worked fine:

--- Code: ---<img src="path/to/forum/index.php?action=dlattach;attach=<?php echo $user_info["avatar"]["id_attach"]; ?>;type=avatar" />
--- End code ---
It would be a lot easier if the $user_info["avatar"]["url"] pointed to the correct url, though..

Kindred:
instead of user_info, you could use
$context['user']['avatar']['href'] or $context['user']['avatar']['image']

guzh:

--- Quote from: Kindred on October 12, 2012, 07:29:33 AM ---instead of user_info, you could use
$context['user']['avatar']['href'] or $context['user']['avatar']['image']

--- End quote ---
Yeah, that's an option. But as he/she's already using some functions in the API it shouldn't be necessary to also use the SSI.

I think that $user_info["avatar"]["url"] should be exactly the same as $context['user']['avatar']['href'], and I think that is the intention as well.
However $user_info["avatar"]["url"] doesn't return anything. it's empty.

Kindred:
incorrect
$user_info['avatar']['url'] returns the RELATIVE filename/URL of the avatar...
[url] => Symbolism/Vetruvian Man.png

assuming the system defined avatar directory for system avatars and the rest of the array is for custom uploaded avatars...


    [avatar] => Array
        (
            [url] => Symbolism/Vetruvian Man.png
            [filename] =>
            [custom_dir] =>
            [id_attach] => 0
        )

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version