YAFLogo

hidden law
  • hidden law
  • 53% (Neutral)
  • YAF Forumling Topic Starter
13 years ago
Hi,
when user selects avatar on the main site I dublicate this data in forum database as following:

using (Stream stream = new MemoryStream())
{
image.Save(stream, ImageFormat.Jpeg);
if (foundUser != null)
DB.user_saveavatar(foundUser, null, stream);
}

Data in AvatarImage column saves correctly, I can check it by calling http://localhost:7839/TestForum/resource.ashx?u=4.
I also set sufficient size for avatar image on Forum Settings page.
But these avatars don't show on the forum.
Please tell me what did I do wrong?


Sponsor

hidden law
  • hidden law
  • 53% (Neutral)
  • YAF Forumling Topic Starter
13 years ago
It's all right now.

I've looked in disassembler code for profile page when Avatar image is initialized:

if ((base.BoardSettings.AvatarUpload && (row["HasAvatarImage"] != null)) && (long.Parse(row["HasAvatarImage"].ToString()) > 0L))
{
this.Avatar.ImageUrl = Data.ForumRoot + "resource.ashx?u=" + base.Request.QueryString["u"];
}
else if (row["Avatar"].ToString().Length > 0)
{
this.Avatar.ImageUrl = string.Format("{3}resource.ashx?url={0}&width={1}&height={2}", new object[] { base.Server.UrlEncode(row["Avatar"].ToString()), base.BoardSettings.AvatarWidth, base.BoardSettings.AvatarHeight, Data.ForumRoot });
}
else
{
this.Avatar.Visible = false;
}

All I have to do was to check 'Allow avatar uploading' option on Forum Settings page.
Mek
  • Mek
  • 100% (Exalted)
  • YAF Developer
13 years ago
🙂 I love self help. Happy you got it sorted mate.

UserPostedImage

"It's a case of RTFM.. the only problem being we don't have a manual!"

When I post FP:Mek in a topic, I'm leaving my footprint there so I can track it once I get into coding/supporting. (Yes I stole this off Ederon 🙂 )
Ipuntmidgets
13 years ago
hello I'm noob and as i was adding avatars to mmy forum but when i tried to use them as admin it gave me and error saying bad request so what do i do (sry if this is a duplicate question)
Ipuntmidgets
13 years ago
i have found out the problem when the picture off of my computer is being put in Yaf is putting an extra backslash ( \ ) in the file so can anyone tell me how to fix it
Ipuntmidgets
13 years ago
hey I'm gonna install the 1.9.3 final and see if that might be an easier way to fix my forum because if it's not then I'm going to ask for some explanation on what to do to fix the problem and thank you
Ipuntmidgets
13 years ago
ok now lemme just give you exactly whats happening this is what it says when one of the avatars get loaded
http://localhost:1224/Yaffinal//images/avatars/avatars/aGa_StreetFighter6.gif
were can i go in the code so i can just fix it im using Yaf Final 1.9.3 35
ttr_fanatic
13 years ago
Hi lpuntmidgets,

I just ran into this myself and looked at EditUsersAvatar.ascx.cs under the "controls" folder. In the Page_Load method there is a call to user_saveavatar:


YAF.Classes.Data.DB.user_saveavatar( CurrentUserID, string.Format( "{0}/images/avatars/{1}", YafForumInfo.ForumBaseUrl, Request.QueryString ["av"] ), null, null );

When I stepped through the debugger, it looks like the YafForumInfo.ForumBaseUrl returns a Url with a "/" on the end so you do not need the extra slash before "images" in the format string.

By the way, I am running 1.9.2 RC2 but it sounds like the same issue - although I was having the issue when selecting an avatar from the site supplied ones. Just an FYI...

Hope this helps...
YAF Logo Copyright © YetAnotherForum.NET & Ingo Herbote. All rights reserved
About Us

The YAF.NET is an open source .NET forum project. YAF.NET is supported by an team of international developers who are build community by building community software.

Powered by Resharper Donate with PayPal button