Page Index Toggle Pages: 1
Topic Tools
Normal Topic UserAvatar uploads fine, mangled in generated HTML (Read 1,450 times)
nichevo
YaBB Newcomer
*
Offline



Posts: 7
UserAvatar uploads fine, mangled in generated HTML
Nov 19th, 2010 at 12:51pm
Post Tools
Hello.

I've been a YaBB admin since 1.x days and so it was a clear contender for a new, small-scale, mostly-private board I wanted to create.

Everything has gone smoothly, except for one problem which I cannot figure out, despite searching and despite much tinkering.

The problem is this. When testing with a dummy user, I uploaded a custom avatar. The file was uploaded successfully -- I can see it clearly through FTP and HTTP. However, when it comes to display the file on the YaBB-created HTML pages, the URL is all wrong.

Let me give you the vital statistics:
  • YaBB version shown in "detailed version check" is YaBB 2.5 AE
  • URL and directory to my board:
    http://members.myisp.com/~myusername/mb/YaBB.pl
    /u/x/myusername/mb/
  • URL and directory to my custom avatars directory:
    http://members.myisp.com/~myusername/mb/yabbfiles/avatars/UserAvatars/
    /u/x/myusername/mb/yabbfiles/avatars/UserAvatars/
  • In Admin Center > Forum Settings > Members, the section that states "At right, the avatar directory path is displayed (top) and whether the directory exists and has the correct permissions (Yes/No)." says "yes" and points to the directory above.
  • In Admin Center > Path Settings:
    • Avatar Dir:
      /u/x/myusername/mb/yabbfiles/avatars
    • Avatar URL:
      /~myusername/mb/yabbfiles/avatars


And the crux of the issue... the HTML generated by YaBB to show the custom avatar:

Code (HTML)
Select All
<img src="/~myusername/mb/yabbfiles/avatars//~myusername/mb/yabbfiles/avatars/UserAvatars/test-80.jpg" name="avatar_img_resize_1" alt="" border="0" style="display:none" /> 



Naturally this doesn't work.

Can anyone suggest what to try to fix this?
  
Back to top
 
IP Logged
 
Captain John
Ex Member


Re: UserAvatar uploads fine, mangled in generated HTML
Reply #1 - Nov 19th, 2010 at 3:55pm
Post Tools
nichevo wrote on Nov 19th, 2010 at 12:51pm:
# Avatar URL:
/~myusername/mb/yabbfiles/avatars


An "url" ....... meaning required to start with "http://www. " (without quotes)
  
Back to top
 
IP Logged
 
nichevo
YaBB Newcomer
*
Offline



Posts: 7
Re: UserAvatar uploads fine, mangled in generated HTML
Reply #2 - Nov 20th, 2010 at 2:15am
Post Tools
Quote:
An "url" ....... meaning required to start with "http://www. " (without quotes)


I take your point about the protocol part (http://) but my domain doesn't actually start with www.

On your recommendation I changed my Avatar URL in Path Settings to the following:
Code
Select All
http://members.myisp.com/~myusername/mb/yabbfiles/avatars 



Alas, it didn't help, all it did was change the generated avatar HTML to this non-working code:
Code (HTML)
Select All
<img src="http://members.myisp.com/~myusername/mb/yabbfiles/avatars//~myusername/mb/yabbfiles/avatars/UserAvatars/test-80.jpg" name="avatar_img_resize_1" alt="" border="0" style="display:none" /><br />
 



I am very confused as to why YaBB feels it needs to "double up" on the link to the avatar file. What could be causing it to do this?
  
Back to top
 
IP Logged
 
Captain John
Ex Member


Re: UserAvatar uploads fine, mangled in generated HTML
Reply #3 - Nov 20th, 2010 at 2:53am
Post Tools
Well the URL is correct now .......
  Do you have a backslash at the end of ANY URL or Dir in Path Settings ? (None should have)
  
Back to top
 
IP Logged
 
nichevo
YaBB Newcomer
*
Offline



Posts: 7
Re: UserAvatar uploads fine, mangled in generated HTML
Reply #4 - Nov 20th, 2010 at 3:05am
Post Tools
Quote:
Well the URL is correct now .......
 Do you have a backslash at the end of ANY URL or Dir in Path Settings ? (None should have)


Good thing to check, which I've done, but there are no trailing slashes/backslashes in any path.
  
Back to top
 
IP Logged
 
Lopa
Junior Member
**
Offline



Posts: 95
Location: Australia
Re: UserAvatar uploads fine, mangled in generated HTML
Reply #5 - Nov 20th, 2010 at 8:17am
Post Tools
Path and Url Settings ?

http://members.myisp.com/~myusername/mb/yabbfiles/avatars/UserAvatars/ ??
/u/x/myusername/mb/yabbfiles/avatars/UserAvatars/ ??

I run a http://members. thing, and I can't duplicate what you're getting?

Also, Where's the /cgi-bin/ supposed to be in your "URL and directory to my board:"

And if I didn't know better, this url:

src="http://members.myisp.com/~myusername/mb/yabbfiles/avatars//~myusername/mb/yabbfi..." name="avatar_img_resize_1" alt="" border="0" style="display:none" /><br />

indicates that you have TWO url's (one behind the other) in the ACP path settings?

This you added - http://members.myisp.com/ but this //~myusername appears to be in the  same line. ?
« Last Edit: Nov 20th, 2010 at 8:36am by Lopa »  

I make mistakes - That's how I learn.
Back to top
WWW  
IP Logged
 
nichevo
YaBB Newcomer
*
Offline



Posts: 7
Re: UserAvatar uploads fine, mangled in generated HTML
Reply #6 - Nov 20th, 2010 at 8:58am
Post Tools
Lopa wrote on Nov 20th, 2010 at 8:17am:
Also, Where's the /cgi-bin/ supposed to be in your "URL and directory to my board:"


I don't think it's required for my ISP... All I can say is that everything I've tested on this board works other than this one UserAvatars thing. I would imagine if I needed to be using a cgi-bin directory and wasn't then the board would not be working at all?

Lopa wrote on Nov 20th, 2010 at 8:17am:
And if I didn't know better, this url ... indicates that you have TWO url's (one behind the other) in the ACP path settings?

This you added - http://members.myisp.com/ but this //~myusername appears to be in the  same line. ?


I have double-checked and I no path field in the Path section of the ACP shows any "double" URLs or directories.
  
Back to top
 
IP Logged
 
Lopa
Junior Member
**
Offline



Posts: 95
Location: Australia
Re: UserAvatar uploads fine, mangled in generated HTML
Reply #7 - Nov 20th, 2010 at 9:18am
Post Tools
Have you checked Paths.pl for something similar to this as far as the VARS are concerned. I know the paths do not reflect yours - just check for single url entries in-line with the variables.

Code
Select All
########## Directories ##########

$facesdir = "I:/xampp/htdocs/yabbfiles/avatars";  # Base Path for all avatar files

########## URL's ##########

$facesurl = "http://127.0.0.1/yabbfiles/avatars"; # Base URL for all avatar files 

  

I make mistakes - That's how I learn.
Back to top
WWW  
IP Logged
 
nichevo
YaBB Newcomer
*
Offline



Posts: 7
Re: UserAvatar uploads fine, mangled in generated HTML
Reply #8 - Nov 20th, 2010 at 12:17pm
Post Tools
Seems okay there. I have:

Code (Perl)
Select All
$facesdir = "/u/x/myusername/mb/yabbfiles/avatars";

...

$facesurl = "http://members.myisp.com/~myusername/mb/yabbfiles/avatars"; 

  
Back to top
 
IP Logged
 
nichevo
YaBB Newcomer
*
Offline



Posts: 7
Re: UserAvatar uploads fine, mangled in generated HTML
Reply #9 - Nov 20th, 2010 at 12:43pm
Post Tools
I've fixed the problem. I'm still a bit confused but let me first post what I did before I forget.

In Sources\Load.pl I changed the following line. (Line 357 for me.)

Before:
Code (Perl)
Select All
${$uid.$user}{'userpic'} = qq~<img src="~ .(${$uid.$user}{'userpic'} =~ m~\A[\s\n]*https?://~i ? ${$uid.$user}{'userpic'} : "$facesurl/${$uid.$user}{'userpic'}") . qq~" name="avatar_img_resize" alt="" border="0" style="display:none" /><br />~; 



After:
Code (Perl)
Select All
${$uid.$user}{'userpic'} = qq~<img src="~ .(${$uid.$user}{'userpic'} =~ m~\A[\s\n]*https?://~i ? ${$uid.$user}{'userpic'} : "${$uid.$user}{'userpic'}") . qq~" name="avatar_img_resize" alt="" border="0" style="display:none" /><br />~; 



My Perl is shockingly bad, so I'm not really sure why this worked, but I intend to try to nut it out... After all I want to know why this happened, and if possible I would rather be running vanilla code rather than something I've messed with.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Topic Tools