TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

April 16, 2024, 10:30:55 PM

Login with username, password and session length
Members
  • Total Members: 3,885
  • Latest: Growner
Stats
  • Total Posts: 195,164
  • Total Topics: 21,219
  • Online today: 106
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online

Avatar by URL not working in Article Comments

Started by lurkalot, February 15, 2018, 10:32:44 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

tino

Works via the proxy for me, can you see if the fix I posted fixes your issue also?

@rjen

Quote from: lurkalot on February 16, 2018, 09:59:43 PM
Quote from: tino on February 16, 2018, 09:32:44 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 Latest TP on SMF2.1 at: www.fjr-club.nl

lurkalot

I'm not using proxy, it's just a local http test site.

tino

Quote from: lurkalot on February 16, 2018, 10:32:33 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

lurkalot

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?

tino

Quote from: lurkalot on February 16, 2018, 11: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?

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 ''

lurkalot

As far as I can see I've edited it correctly. Attached below.

@rjen

Quote from: tino on February 16, 2018, 10:41:25 PM
Quote from: lurkalot on February 16, 2018, 10:32:33 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

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 Latest TP on SMF2.1 at: www.fjr-club.nl

tino

Try this code
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;" />');

@rjen

Quote from: tino on February 17, 2018, 10:32:56 AM
Try this code
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 Latest TP on SMF2.1 at: www.fjr-club.nl