On Fri, Oct 7, 2011 at 6:37 AM, Yang Li <[email protected]> wrote:
> Hi all,
>
>
>
> I found that the user portrait displayed in activity stream macro is scaled
> smaller with the following markup:
>
> <img alt="username" src="
> xwiki/bin/download/XWiki/yangli/obamaMao.jpg?width=50&amp;height=50&amp;keep
> AspectRatio=true" title="username">
>
>
>
> However, the quality of the resulted image is very poor and highly distorted
>
>
>
> However, if we use an alternative as
>
> <img alt="username" src=" xwiki/bin/download/XWiki/yangli/obamaMao.jpg "
> width=50 title="username">
>
> The resulted picture would look much better!
>
>
>

> The first way saves network flow, however, I prefer better and larger user
> portrait display.

There is another option, in between these two:

/xwiki/bin/download/XWiki/UserName/avatar.jpg?width=50&height=50&keepAspectRatio=true&quality=1

This way the avatar is resized but at a good quality. You can play
with the quality if you want, its value is between 0 and 1, the
default being 0.5.

>
>
>
> So it seems that I can (maybe cannot) modify the activity stream and comment
> macro to get a better display of the user portrait, however, the macro is an
> jar, which makes it a little bit difficult for me.

It's not in a jar. Macros can be implemented either in Java or in wiki
pages. In this case the activity macro is implemented in Main.Activity
page. Edit it with the object editor and look for the
XWiki.WikiMacroClass object. I checked the code and there is a
Velocity macro named "activitySnapshot" which is described as "Display
user avatar and action message". This macro uses in turn the
"smallUserAvatar" which you can find in macros.vm template (file
system). All "<size>userAvatar" Velocity macros are calling
resizedUserAvatar which generated the image HTML. You can remove the
query string or add quality, as you wish, but don't forget to restart
the server because macros.vm is cached.

Hope this helps,
Marius

>
>
>
> So any suggestions?
>
>
>
> Thanks all : )
>
>
>
> _______________________________________________
> users mailing list
> [email protected]
> http://lists.xwiki.org/mailman/listinfo/users
>
_______________________________________________
users mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to