Fórum

Set default avatar image (male/female) in theme

Jan Koch, modificado 7 Anos atrás.

Set default avatar image (male/female) in theme

New Member Postagens: 3 Data de Entrada: 08/09/16 Postagens Recentes
Hi,
is there a chance to define the default avatar images for male and female in a theme?

I found a solution to set it in the "portal-ext.properties" but i want to define the pictures in the theme because different themes should have different default avatar images.
thumbnail
David H Nebinger, modificado 7 Anos atrás.

RE: Set default avatar image (male/female) in theme

Liferay Legend Postagens: 14919 Data de Entrada: 02/09/06 Postagens Recentes
No, avatar images come from the backend, not from the theme.

You might consider a model wrapper around the User model object. All paths to the avatar image goes through here. You can then leverage company id-specific logic to return different images. Unfortunately I don't think you'll be able to determine what theme is current.

The idea is that a user has an avatar, not a theme.
Jan Koch, modificado 7 Anos atrás.

RE: Set default avatar image (male/female) in theme

New Member Postagens: 3 Data de Entrada: 08/09/16 Postagens Recentes
Thank You for the fast reply.

David H Nebinger:
The idea is that a user has an avatar, not a theme.


I understand the idea but from the view of a designer this is not good. With a theme you create a special Look and Feel based on the CD & CI of the Company. So it's completely logical to design and customize the default avatar images as well.

A view weeks ago I had the "Styling Liferay with Themes" Workshop with OLAF KOCK. He said, that default images and sources are theme based and i should use this resources in the theme.

What will a Frontend-Developer now do - write a Javascript which replaces the default images with your own - in my opinion - a bad workaround.

In my view - every visual defaults should have the option to overwrite it with the theme.
thumbnail
David H Nebinger, modificado 7 Anos atrás.

RE: Set default avatar image (male/female) in theme

Liferay Legend Postagens: 14919 Data de Entrada: 02/09/06 Postagens Recentes
Your issue, however, is specific.

If I load a picture of myself, it doesn't matter what the theme is, my picture should still be there.

In your case, the default images are shown when the user hasn't loaded an image, but this is still not a theme-driven image, it is user-driven.

Like I said, I think you could do what you're hoping for using a model wrapper to override what image url is used so can do what you're looking to do, there's just no way by default to make the change using the theme.
Jan Koch, modificado 7 Anos atrás.

RE: Set default avatar image (male/female) in theme

New Member Postagens: 3 Data de Entrada: 08/09/16 Postagens Recentes
Thank You for your explanation.

You are right in that way the user has customized his avatar image. Then it is user related.

But when the user do not customized his avatar image - it is theme related. If not - all websites using the same Liferay instance are forced to use the default portrait pictures (or the ones you can customize with a package). For example - if you build a comic related site with Liferay - wouldn't it be nice that the default avatar images are in comic style? And on the same instance of Liferay You build a company site - so now u have the choice to use either the comic style or the company style.

So why not configure the images in the theme? If the portraitId of the user is 0 Liferay looks if the theme has such a configuration - if not, use the default Liferay pictures. Isn't that logical?
Or why not using css to make that work - a wrapper around the image with a CSS class "user-portrait" and if it is the default portrait add the CSS class "user-portrait-default". So everyone can customize it over the theme.