MyBB Community Forums

Full Version: Images in profile
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Most of my members have an image located at "example.com/images/***.png", and I want this to be shown on their profiles. How would I go about this? (*** is just my filler text. They each have a different value to input where I put the ***).

I want to use a custom profile field, but I'm not really sure how I would make it show an image, as opposed to just showing their URL. How would I go about this?

Custom profile fields just save raw text, and I need to be able to make it an image. Right now it just shows:

{imagelocation}

But I need it to show:

<img src="http://example.com/images/{imagelocation}.png />
[/code]
This is me thinking out loud, so somebody else will tell me I'm wrong in a bit Toungue

<img src="http://example.com/images/user/{$member_profile->['uid']}.png" />

That's what I'm thinking of. Then, the user with UID 1 would upload an image called '1.png' to ./images/user/ (the 'user' folder being something you create) and then it would show that.

I'm using the logic from this thread but I highly doubt I've got it completely right.

Only problem with that is how would the users upload the images there...
Hmm.. well, it's a dynamic image.. so I don't think that will work.

I think that this is the right template.

<tr>
<td class="{$bgcolor}" width="40%"><strong>{$customfield['name']}:</strong></td>
<td class="{$bgcolor}" width="60%">{$customfieldval}</td>
</tr>

Would this work?

<?php
if ($customfield['name']=="gcn")
     {
     echo "<tr>";
     echo "<td class="{$bgcolor}" width="40%"><strong>{$customfield['name']}:</strong></td>";
     echo "<td class="{$bgcolor}" width="60%"><img src=\"http://example.com/images/{$customfieldval}.png\" /></td>";
     echo "</tr>";
     }
else
     {
     echo "<tr>";
     echo "<td class="{$bgcolor}" width="40%"><strong>{$customfield['name']}:</strong></td>";
     echo "<td class="{$bgcolor}" width="60%">{$customfieldval}"</td>";
     echo "</tr>";
     }
?>

EDIT: Escaped my quotations.
Not sure about the logic - MyBB does not allow PHP in the templates, and even so, you'll need to escape some of those quotation marks for the PHP to work.

As Matt says, the only way to get it to work would be:

<img src="http://example.com/images/user/dynamic.php?id={$member['uid']}" />

... where dynamic.php is the image creating script, and ID is your GET value...
Hm.. well there are two problems:

1. The dynamic image is not hosted on my server, so I can't rename it.
2. Not all of the members have these image, so it would produce a "Image cannot be displayed" icon, right?

Why isn't PHP allowed in templates? Sad
What's the code for this dynamic image?? Do you have access to it?? How exactly does it work??
It's a tracker, for the Xbox 360. http://mygamercard.net
The image is located at "http://card.mygamercard.net/{gamertag}.png"

So mine would be..

[Image: bundyxc.png]
http://card.mygamercard.net/bundyxc.png

You go to the site, and sign up.
After that, they start hosting an image at http://card.mygamercard.net/{gamertag}.png
They dynamically update it with your statistics from multiplayer gaming.
Alright, so I changed my member_profile_customfields_field to this.

<tr>
<td class="{$bgcolor}" width="40%"><strong>{$customfield['name']}:</strong></td>
<td class="{$bgcolor}" width="60%">{$customfieldval}<td>
</tr>
<tr>
<td class="{$bgcolor}" width="40%"></td>
<td class="{$bgcolor}" width="60%"><img src="http://card.mygamercard.net/{$customfieldval}.png" /></td>
</tr>

That's fine, but it screws with the table a bit.
Any ideas why?

You can see the page here.
http://bundyxc.com/board/member.php?acti...file&uid=2
Bump?