News: TinyPortal Release Schedule. Please read this update for More Info.

Login  |  Register
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media
Welcome, Guest. Please login or register.
Did you miss your activation email?

April 02, 2020, 08:50:29 AM

Login with username, password and session length

Recent

Members
Stats
  • Total Posts: 189572
  • Total Topics: 20808
  • Online Today: 381
  • Online Ever: 917
  • (January 21, 2020, 09:02:26 AM)
Users Online
Users: 1
Guests: 169
Total: 170

Author Topic: Avatar by URL not working in Article Comments  (Read 2453 times)

0 Members and 1 Guest are viewing this topic.

Online lurkalot

  • Administrator
  • *
  • Posts: 6468
    • Camera Craniums
Avatar by URL not working in Article Comments
« on: February 15, 2018, 03:32:44 PM »
I have just noticed, the avatars don't show in article comments. Only when using the "Specify avatar by URL" option. (screenshot below).

Offline tino

  • Developer
  • *
  • Posts: 1737
Re: Avatar by URL not working in Article Comments
« Reply #1 on: February 16, 2018, 03:53:41 AM »
I have just noticed, the avatars don't show in article comments. Only when using the "Specify avatar by URL" option. (screenshot below).

That works for me. Can you let me know the url you used?

Actually it only doesn't work when I have image_proxy_enabled and I visit the site whilst it is http, that causes everything to get in to a bit of a mess. Not sure if that is a valid set up though, as I wouldn't expect to enable image proxy and still have the site http.

Online lurkalot

  • Administrator
  • *
  • Posts: 6468
    • Camera Craniums
Re: Avatar by URL not working in Article Comments
« Reply #2 on: February 16, 2018, 10:27:09 AM »
I have just noticed, the avatars don't show in article comments. Only when using the "Specify avatar by URL" option. (screenshot below).

That works for me. Can you let me know the url you used?

Actually it only doesn't work when I have image_proxy_enabled and I visit the site whilst it is http, that causes everything to get in to a bit of a mess. Not sure if that is a valid set up though, as I wouldn't expect to enable image proxy and still have the site http.

Must admit, I was using my local testbed.  Not sure I had image proxy switched on in SMF though, will have to check that.  The avatars were working everywhere else though as far as I can tell.  Will check this again in a while.

Offline @rjen

  • Support Team
  • *
  • Posts: 2013
    • FJR-club Nederland
Re: Avatar by URL not working in Article Comments
« Reply #3 on: February 16, 2018, 02:02:33 PM »
I checked my testsite and I have the same problem:

For a user where the Avatar is a 'standard one' from the forum, it shows in the comments. I am using an uploaded avatar that is NOT displayed in the comments.

The link used in the comments is that: https://test.fjr-club.nl/avatars/ , it seems to link to the folder, not the actual uploaded image...

I also checked it in 1.3R and there it was working fine.
On the site: SSL with Image proxy fully enabled...
Deactivating the image proxy makes no difference: problem stays
Running TP1.6.4 on SMF2.0 at: www.fjr-club.nl

Testing TP on SMF2.0
Testing TP on SMF2.1 RC2
Want to check what php version I am testing on? See: PHP Info

Offline tino

  • Developer
  • *
  • Posts: 1737
Re: Avatar by URL not working in Article Comments
« Reply #4 on: February 16, 2018, 02:16:01 PM »
So it fails when linked to a image uploaded to the forum? Or it fails when specifing a image uploaded to a local ( to it ) url?

Offline tino

  • Developer
  • *
  • Posts: 1737
Re: Avatar by URL not working in Article Comments
« Reply #5 on: February 16, 2018, 02:32:44 PM »
As you both seem to have reported different errors.

Online lurkalot

  • Administrator
  • *
  • Posts: 6468
    • Camera Craniums
Re: Avatar by URL not working in Article Comments
« Reply #6 on: February 16, 2018, 02:59:43 PM »
As you both seem to have reported different errors.

The uploaded ones work, the stock smf ones work, but if you add one via url it doesn't show in comments, but shows everywhere else in the portal.

Offline tino

  • Developer
  • *
  • Posts: 1737
Re: Avatar by URL not working in Article Comments
« Reply #7 on: February 16, 2018, 03:04:17 PM »
Ok, well the error the @rjen reported I've managed to emulate.

Offline tino

  • Developer
  • *
  • Posts: 1737
Re: Avatar by URL not working in Article Comments
« Reply #8 on: February 16, 2018, 03:06:21 PM »
Line 736 of Sources/TPortal.php should be
Code: [Select]
$avatar = $avatar == '' ? ($row['ID_ATTACH'] > 0 ? '<img src="' . (empty($row['attachmentType']) ? $scripturl . '?action=tpmod;sa=tpattach;attach=' . $row['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) . '" alt="" class="avatar" border="0" />' : '') : (stristr($row['avatar'], 'https://') ? '<img src="' . $row['avatar'] . '"' . $avatar_width . $avatar_height . ' alt="" class="avatar" border="0" />' : '<img src="' . $modSettings['avatar_url'] . '/' . $smcFunc['htmlspecialchars']($row['avatar'], ENT_QUOTES) . '" alt="" class="avatar" border="0" />');


Online lurkalot

  • Administrator
  • *
  • Posts: 6468
    • Camera Craniums
Re: Avatar by URL not working in Article Comments
« Reply #9 on: February 16, 2018, 03:12:32 PM »
http://avatars.simplemachinesweb.com/smf/avatar_124590_1499841922.gif

You can see this image, yes?

If I add that url to my profile it won't show in the article comments, but does show in the article author info, and all other blocks which use an avatar. 

If I use the secure version https://avatars.simplemachinesweb.com/smf/avatar_124590_1499841922.gif

The avatar displays everywhere including the comments.

Offline tino

  • Developer
  • *
  • Posts: 1737
Re: Avatar by URL not working in Article Comments
« Reply #10 on: February 16, 2018, 03:16:18 PM »
Works via the proxy for me, can you see if the fix I posted fixes your issue also?

Offline @rjen

  • Support Team
  • *
  • Posts: 2013
    • FJR-club Nederland
Re: Avatar by URL not working in Article Comments
« Reply #11 on: February 16, 2018, 03:17:51 PM »
As you both seem to have reported different errors.

The uploaded ones work, the stock smf ones work, but if you add one via url it doesn't show in comments, but shows everywhere else in the portal.

Just tried that. URL avatar IS showing on my test site...
Running TP1.6.4 on SMF2.0 at: www.fjr-club.nl

Testing TP on SMF2.0
Testing TP on SMF2.1 RC2
Want to check what php version I am testing on? See: PHP Info

Online lurkalot

  • Administrator
  • *
  • Posts: 6468
    • Camera Craniums
Re: Avatar by URL not working in Article Comments
« Reply #12 on: February 16, 2018, 03:32:33 PM »
I'm not using proxy, it's just a local http test site.

Offline tino

  • Developer
  • *
  • Posts: 1737
Re: Avatar by URL not working in Article Comments
« Reply #13 on: February 16, 2018, 03:41:25 PM »
I'm not using proxy, it's just a local http test site.

Can you try the fix a few posts back. It should sort it as both issues are linked

Online lurkalot

  • Administrator
  • *
  • Posts: 6468
    • Camera Craniums
Re: Avatar by URL not working in Article Comments
« Reply #14 on: February 16, 2018, 04:02:11 PM »
Sort it, as in remove them? I don't seem to have any avatars in comments now. Also the new post image has popped up. should I be seeing this as I was the one who posted?

Offline tino

  • Developer
  • *
  • Posts: 1737
Re: Avatar by URL not working in Article Comments
« Reply #15 on: February 16, 2018, 04:12:13 PM »
Sort it, as in remove them? I don't seem to have any avatars in comments now. Also the new post image has popped up. should I be seeing this as I was the one who posted?

It didn’t remove them for me. I guess you either didn’t edit it correctly or I posted the wrong thing.

It’s adding the $avatar == after the first = and before the ‘’

Online lurkalot

  • Administrator
  • *
  • Posts: 6468
    • Camera Craniums
Re: Avatar by URL not working in Article Comments
« Reply #16 on: February 16, 2018, 04:41:44 PM »
As far as I can see I've edited it correctly. Attached below.

Offline @rjen

  • Support Team
  • *
  • Posts: 2013
    • FJR-club Nederland
Re: Avatar by URL not working in Article Comments
« Reply #17 on: February 17, 2018, 02:50:06 AM »
I'm not using proxy, it's just a local http test site.

Can you try the fix a few posts back. It should sort it as both issues are linked

I tried your fix too, and the result is that in the first comment the Avatar shows, but in the second comment (same user) it does NOT...

Running TP1.6.4 on SMF2.0 at: www.fjr-club.nl

Testing TP on SMF2.0
Testing TP on SMF2.1 RC2
Want to check what php version I am testing on? See: PHP Info

Offline tino

  • Developer
  • *
  • Posts: 1737
Re: Avatar by URL not working in Article Comments
« Reply #18 on: February 17, 2018, 03:32:56 AM »
Try this code
Code: [Select]
if ($image_proxy_enabled && !empty($row['avatar']) && stripos($row['avatar'], 'http://') !== false)
      $avatar = '<img src="'. $boardurl . '/proxy.php?request=' . urlencode($row['avatar']) . '&hash=' . md5($row['avatar'] . $image_proxy_secret) .'" alt="&nbsp;" />';
else
      $avatar = $row['avatar'] == '' ? ($row['ID_ATTACH'] > 0 ? '<img src="' . (empty($row['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $row['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) . '" alt="&nbsp;"  />' : '') : (stristr($row['avatar'], 'https://') ? '<img src="' . $row['avatar'] . '" alt="&nbsp;" />' : stristr($row['avatar'], 'http://') ? '<img src="' . $row['avatar'] . '" alt="&nbsp;" />' : '<img src="' . $modSettings['avatar_url'] . '/' . $smcFunc['htmlspecialchars']($row['avatar'], ENT_QUOTES) . '" alt="&nbsp;" />');

Offline @rjen

  • Support Team
  • *
  • Posts: 2013
    • FJR-club Nederland
Re: Avatar by URL not working in Article Comments
« Reply #19 on: February 17, 2018, 04:31:19 AM »
Try this code
Code: [Select]
if ($image_proxy_enabled && !empty($row['avatar']) && stripos($row['avatar'], 'http://') !== false)
      $avatar = '<img src="'. $boardurl . '/proxy.php?request=' . urlencode($row['avatar']) . '&hash=' . md5($row['avatar'] . $image_proxy_secret) .'" alt="&nbsp;" />';
else
      $avatar = $row['avatar'] == '' ? ($row['ID_ATTACH'] > 0 ? '<img src="' . (empty($row['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $row['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) . '" alt="&nbsp;"  />' : '') : (stristr($row['avatar'], 'https://') ? '<img src="' . $row['avatar'] . '" alt="&nbsp;" />' : stristr($row['avatar'], 'http://') ? '<img src="' . $row['avatar'] . '" alt="&nbsp;" />' : '<img src="' . $modSettings['avatar_url'] . '/' . $smcFunc['htmlspecialchars']($row['avatar'], ENT_QUOTES) . '" alt="&nbsp;" />');

That fixes the problem for me.
Running TP1.6.4 on SMF2.0 at: www.fjr-club.nl

Testing TP on SMF2.0
Testing TP on SMF2.1 RC2
Want to check what php version I am testing on? See: PHP Info

Online lurkalot

  • Administrator
  • *
  • Posts: 6468
    • Camera Craniums
Re: Avatar by URL not working in Article Comments
« Reply #20 on: February 17, 2018, 04:40:29 AM »

That fixes the problem for me.


And for me.  I've tried various combinations in the avatar setting and they appear to work nicely now.