Gravatar bug (wrong url)
I encountered a strange bug. Any user with an avatar uploaded to the site displays fine, but a user that has a Gravatar doesn't. After looking at the image source, I noticed that on the Home page, the url is showing as "ngravatar.com". If I remove the n from the url, the image would work fine. On the discussion page, the url is "pgravatar.com".
If I switch themes to the default Vanilla with everything else the same, the Gravatar's display, so it is this theme causing the url to change. I've got through every line of every file in this theme and I just can't figure out where these n and p characters are getting added to the Gravatar url.
Any ideas?
Best Answer
-
mcu_hq ✭✭✭
Good catch. I recall having troubles with Gravatar myself and instead of looking into it initially, I skipped it. Looks like I forgot to revisit that problem.
The 'n' and 'p' designate different sources of the same image. the 'p' is the largest of them all with n being smallest. Instead of using the core functions to get the image (UserPhoto), I would prepend the size to the URL. Problem with this method is that if someone does not have an uploaded image, it won't work properly as you can see.
In the discussions view, I use the author's profile pic with dimensions like 92px x 92px. The UserPhoto function that ships with Vanilla won't let me select the raw uploaded image as the source ('p'). Because of this I did my own workaround, which neglected to ever call 'UserPhotoDefaultUrl', which is where the Gravatar link will be substituted in if there is not existing photo URL. Yes, I can always set widths/heights in CSS, but stretching a small resolution picture looks like utter shit.
I've updated the code to reflect these changes...expect a new version in the coming days for both theme/plugin.
0
Answers
Good catch. I recall having troubles with Gravatar myself and instead of looking into it initially, I skipped it. Looks like I forgot to revisit that problem.
The 'n' and 'p' designate different sources of the same image. the 'p' is the largest of them all with n being smallest. Instead of using the core functions to get the image (UserPhoto), I would prepend the size to the URL. Problem with this method is that if someone does not have an uploaded image, it won't work properly as you can see.
In the discussions view, I use the author's profile pic with dimensions like 92px x 92px. The UserPhoto function that ships with Vanilla won't let me select the raw uploaded image as the source ('p'). Because of this I did my own workaround, which neglected to ever call 'UserPhotoDefaultUrl', which is where the Gravatar link will be substituted in if there is not existing photo URL. Yes, I can always set widths/heights in CSS, but stretching a small resolution picture looks like utter shit.
I've updated the code to reflect these changes...expect a new version in the coming days for both theme/plugin.
Thanks mcu_hq, I appreciate the reply. I look forward to the new version. I've been modifying the theme quite heavily and it's nearly ready to be used on my production site. The gravatar bug is the only thing holding me back so far, otherwise, the theme/plugin have been a lifesaver.
@MotiveKyle I have updated them both...I've spent a great deal of time getting it to work in IE7.
If you want, you can hide the sidepanel and change the width to be either fluid (%) or fixed (px)
Added more stylish crap:
Also, just realized that the magnifiing glass is offset incorrectly after I added the little house on the left. Instead of uploading a whole new version, just do this:
Add this to custom.css to fix the search icon offset:
.SearchFinderImage { margin-left: 250px; }
Most of the changes were formatting, but there were some colors added, so you may want to perform a diff using notepad++ or something to merge your changes. And since you are creating your own spinoff, it would be VERY cool if you could seperate the functionality CSS from the colors/stylish aspect so then I could make just make two CSS files in the future to make it easier to manage and customize.