Jump to content

How can I display letter profile photos in 4.4.x?

Featured Replies

Posted

I can see they are passed as a url encoded string, like follows:

data:image/svg xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" style="background:#a462c4"><g><text text-anchor="middle" dy=".35em" x="512" y="512" fill="#ffffff" font-size="700" font-family="-apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif">M</text></g></svg>

But I don't see this directly called out in the member data base table.  Just if a member has a custom photo.  Any ideas on how to query the database and construct these svg type profile (letter) photos?  Thanks!!

  • Community Expert

I’m not sure what you are trying to do. The function is generateLetterPhoto in /system/Member/Member.php if you want to look it up. 
But I don’t know why you want to query the database at all. Usually you just call the userPhoto template, which does everything for you. 

<img src='{$member->photo}' alt='' referrerpolicy='origin-when-cross-origin'>

The code you pasted can go directly in the src attribute and will be returned automatically if using letter photos. Alternatively, a custom profile photo URL will be returned if appropriate.

  • Author
On 4/7/2019 at 1:03 AM, opentype said:

I’m not sure what you are trying to do. The function is generateLetterPhoto in /system/Member/Member.php if you want to look it up. 
But I don’t know why you want to query the database at all. Usually you just call the userPhoto template, which does everything for you. 

I'm updating a 3rd party external app that needs to play friendly with IPBs 4.4.x user database.  I'll see what I can lift from that function. 

Archived

This topic is now archived and is closed to further replies.

Recently Browsing 0

  • No registered users viewing this page.