Steven Webster
Customers
Post Count:1665
 |
| 28 Mar 2009 03:13 PM |
|
I've been wanting to show a user's profile avatar along with a link to their profile on Property Agent and News Articles. While you setup a link using a direct path and a replacement token for USERID if the user didn't have an avatar setup you got a big red x. So, I created an image handler that will take in two parameters in a querystring (Active Social UserID and The Image Size you want to show) and display the correct avatar for that user. If the user has uploaded a pic, it shows that and if not then is shows the default avatar from the default theme. Please note, this is donated and completely unsupported code. User and modify at your own risk. Installation Instructions:1. Upload the attached file ProfileImageHandler.ashx to your portal. (e.g. C:\DNN\Portals\0\ProfileImageHandler.ashx) 2. Make sure permissions are set correctly for this file Using the ProfileImageHandler.ashx1. Create a template and reference the image using the Handler's aboslute URL 2. Pass in the asuserid as a querystring using a replacement token for UserID from the calling module 3. Pass in the asimgsize as a querystring so choose which size image you want to call. (This needs to match your image size settings from Active Social) e.g.  4. Optionally you can wrap this with link back to the Active Social Pofile e.g.  If you want to call a default image from a different theme, you'll need to modify line 20 in the handler: Change this: defaultImagePath = context.Server.MapPath("../../DesktopModules/ActiveSocial/themes/_default/images/profile_med.gif") to this: defaultImagePath = context.Server.MapPath("../../DesktopModules/ActiveSocial/themes/MyCustomTheme/images/profile_med.gif") |
ProfileImageHandler.zip
|
Steven Webster dnnOsphere.com, An Independent Community for DotNetNuke Users |
|
|
Steven Webster
Customers
Post Count:1665
 |
| 28 Mar 2009 03:32 PM |
|
OK, my examples got cut off: Here is an example cut from a Property Agent View.htm template  |
|
Steven Webster dnnOsphere.com, An Independent Community for DotNetNuke Users |
|
|
Cliff Hammock
Customers
Post Count:667
 |
| 28 Mar 2009 09:52 PM |
|
Thanks Steven. I will check this out tomorrow. Cliff |
|
|
|
|
Steven Webster
Customers
Post Count:1665
 |
| 29 Mar 2009 09:58 PM |
|
Here is the template to integrate this into the UVG Video Information. It shows the correct AS Avatar and links back to the AS Profile. You need to change the code for your site and implement the ProfileImageHandler.ashx above.  |
UVG_VideoInformationTemplate.txt
|
Steven Webster dnnOsphere.com, An Independent Community for DotNetNuke Users |
|
|
Frozen DNN
Customers
Post Count:1331
 |
| 29 Mar 2009 10:56 PM |
|
I can't see the pics, nor can I download the attachments! Is this happening to anyone else or it's just me? Thanks for sharing, Swebster. |
|
I am using the latest AS/AF/DNN available.
Thanks. |
|
|
Duane
Customers
Post Count:415
 |
| 30 Mar 2009 11:49 AM |
|
Working fine for me. Thanks Steven |
|
|
|
|
Rheebo
Customers
Post Count:208
 |
| 30 Mar 2009 12:04 PM |
|
Steven I noticed above that you are using the map search module for PA. How is that going -- does it work for you? I thought about giving it a try -- |
|
Carl
Zone Labs, Inc
www.zonediet.com
"brain shots for everyone"
|
|
|
Steven Webster
Customers
Post Count:1665
 |
| 30 Mar 2009 11:03 PM |
|
Love the PropertyMap module. Great module and lots of support |
|
Steven Webster dnnOsphere.com, An Independent Community for DotNetNuke Users |
|
|
Frozen DNN
Customers
Post Count:1331
 |
| 31 Mar 2009 02:24 AM |
|
Wow, it's my firewall! I disabled it and it works (I can see and download). |
|
I am using the latest AS/AF/DNN available.
Thanks. |
|
|
Cliff Hammock
Customers
Post Count:667
 |
| 02 Apr 2009 06:26 PM |
|
I did not do the image handler. I just added the link to the resx file to the image and the name using AUTHORID. Is the image handler better from a performance standpoint? I actually got the links to work the first time. I was pretty happy. Cliff |
|
|
|
|
Steven Webster
Customers
Post Count:1665
 |
| 02 Apr 2009 11:07 PM |
|
Cliff, Image Handlers are support to be very efficient. However, I wrote this to come up with a single point for this type of functionality in template-able module (news articles, blogs, UVG, etc) |
|
Steven Webster dnnOsphere.com, An Independent Community for DotNetNuke Users |
|
|
Yael Kroy
Registered Users
Post Count:158
 |
| 03 Apr 2009 04:28 AM |
|
It is strange, but for me it does not work my user profile http://transgender.ru/Общаться/Мой_профайл/tabid/440/asuid/1785/Default.aspx so my user id 1785 http://transgender.ru/portals/0/ProfileImageHandler.ashx?asuid=1785&asimgsize=50 it shows not my avatar. Thanks |
|
|
|
|
Steven Webster
Customers
Post Count:1665
 |
|
Cliff Hammock
Customers
Post Count:667
 |
| 03 Apr 2009 08:23 AM |
|
Yael, I have to be honest that I am concerned to visit your site; especially from work, given the title. Can you confirm the nature of the content on the site? I hope this does not come across as prejudiced or anything, I just have to be careful which sites I hit. I hope you understand. @Steven - since you apparently have visited Yael's site, would you consider it to be OK to visit from a workplace? If not, maybe I will RDP into my server from here to check it out. Thanks. Cliff |
|
|
|
|
Satayu Sengsomwong
Customers
Post Count:
 |
| 26 Apr 2009 04:33 AM |
|
Steve, what image size do I have to type in? The userid is correct and so is the link (it links back to may AS user profile) but the image is not rendered. I guess because of a wrong image size like Yael.. Btw: Would it be possible to change the skript that any mini avatar image will be displayed, disregarding the size? |
|
|
|
|
Steven Webster
Customers
Post Count:1665
 |
| 26 Apr 2009 08:22 AM |
|
It just has to match one of the sizes you specified in the AS control panel. So if your medium size is 100 x 100 then use 100. |
|
Steven Webster dnnOsphere.com, An Independent Community for DotNetNuke Users |
|
|
Craig Dean
Customers
Post Count:28
 |
| 07 May 2009 09:03 AM |
|
Please find an updated version of the ProfileImageHandler by Steven Webster.
I've rewritten the code in C#, and made it a lot more robust. It is designed to sit in the root directory of your website, but you can easily move it to another directory. To configure it correctly make sure you set up the variables in the static constructor.
New features include: 1) By default it will return the next largest image from the one requested, so if you request an image of size 100, but you only have images of size 75 & 150, you'll get the 150. If you don't request an image size or you request a larger image than the sized images you'll get the original image (e.g. pp_1.png). 2) Has extra parameter exactsize=true. If you set it you'll get a default image if an exact sized image is not available 3) Has extra parameter default=/images/default.png. Allows you to override the default image. 4) Correctly supports image content types. 5) Supports multiple default images of differring sizes. (Currently configured to use profile_sm.png & profile_med.gif that come with active social, but you can easily change).
If you want a profile image of a specific size, set the image size on the img tag and then request the size you want. Because you get the next largest image then it will scale nicely. This allows yout to pick your image sizes, secure in the knowledge you'll always get the best fit.
Let me know if it's helpful.
Craig |
ProfileImageHandler.zip
|
|
|
|
Craig Dean
Customers
Post Count:28
 |
| 08 May 2009 02:46 AM |
|
Now if anyone can suggest how to make use of this in the standard DNN blog without recompiling the code, I'd be grateful  |
|
|
|
|
Steven Webster
Customers
Post Count:1665
 |
| 08 May 2009 10:08 AM |
|
Nice additions Craig. |
|
Steven Webster dnnOsphere.com, An Independent Community for DotNetNuke Users |
|
|
Craig Dean
Customers
Post Count:28
 |
| 08 May 2009 10:15 AM |
|
Thanks, I only wrote it because I wanted to use it my blogs, but having checked out the standard DNN Blog module, it doesn't look like it'll be that easy to change the template to return the userid, unless I change & recompile the code, which I really want to avoid. It'd be nice to know someone managed to find a use for it though There are a number of potential enhancements as well to do with pre-checking of default images, but I only had half an hour. Craig |
|
|
|
|
Dan Ball
Customers
Post Count:582
 |
| 08 May 2009 10:39 AM |
|
Supposedly the Ventrian Module (don't remember if it is the News Agent or the Property Agent, I get those confused) can work as a blog, and is completly customizable.
|
|
|
|
|
Smart-Thinker
Customers
Post Count:546
 |
| 15 Jun 2009 10:23 PM |
|
This image handler is really useful, but should this functionality not make more sense to be in the AS core do you think? |
|
thanks Rodney Joyce PokerDIY.com - Connecting Poker Players |
|
|
Craig Dean
Customers
Post Count:28
 |
| 15 Jun 2009 10:47 PM |
|
I haven't licensed my version of the code, or at least it's free for commercial & non-commercial use, so the active modules team are free to use as is (as is anyone here), but they may feel it's a departure from their core offerring. We deployed a similar (but much fancier - including file cache) version of an image handler on our newest web product which uses it extensively. We saw web pages download up to 10x faster! In that case the majority of the images on the site were uploaded by non-techie users so we also deployed a Java uploader to downsize images on the client before uploading. (And watermark etc.) The performance of the two combined has saved about 90% of the bandwidth utilisation and vastly sped up the user experience. Whether it'd be as useful for ActiveSocial is up to the active modules team. Our product uses a lot of user images. |
|
|
|
|
Smart-Thinker
Customers
Post Count:546
 |
| 15 Jun 2009 11:45 PM |
|
Sounds good! Caching is important, especially on thumbnails which are potentially shown everywhere. I was just thinking it's one more component to worry about on upgrades etc - so it would be nice if it were managed by AS but it's not serious... |
|
thanks Rodney Joyce PokerDIY.com - Connecting Poker Players |
|
|
Raymond
Customers
Post Count:154
 |
| 17 Jun 2009 12:44 PM |
|
Very helpful, thanks.
I just used it with the News Article templates and it worked like a charm.
|
|
|
|
|
Steven Webster
Customers
Post Count:1665
 |
| 17 Jun 2009 02:14 PM |
|
Posted By Smart-Thinker on 15 Jun 2009 11:23 PM
This image handler is really useful, but should this functionality not make more sense to be in the AS core do you think?
Yes! I started the ball rolling on this as a side project and something I thought a lot of people could use/extend (which is what happened). My hope was that it would eventually be absorbed into AS. (not my code specifically - but the concept). |
|
Steven Webster dnnOsphere.com, An Independent Community for DotNetNuke Users |
|
|
Will Sugg
Customers
Post Count:534
 |
| 03 Sep 2009 06:57 AM |
|
I am having a problem with the image handler and Ventrian News Articles. Or maybe the problem is with NA itself? When someone adds a comment to an article, the comment shows up but with the photo of the author rather than the commenter. So you have a stack of comments from different people with all the same pic of the author beside them. Any ideas? thanks, Will |
|
|
|
|
Dan Ball
Customers
Post Count:582
 |
| 03 Sep 2009 07:04 AM |
|
It is probably your layout file in NA, did you use the right UserID? |
|
|
|
|
Steven Webster
Customers
Post Count:1665
 |
| 03 Sep 2009 07:16 AM |
|
I agree. Make sure you comment template in NA passes in the userid of the commenter, not the author. |
|
Steven Webster dnnOsphere.com, An Independent Community for DotNetNuke Users |
|
|
Will Sugg
Customers
Post Count:534
 |
| 03 Sep 2009 02:42 PM |
|
Thanks guys that did it. |
|
|
|
|