Yii-User: How to add user's image to profiles

Hello,

I am starting a new project and want to use yii-user for that. The problem I am facing is that I dont understand how can I add user’s image in profile. Does anyone have any idea?

Regards,

This may help you http://www.yiiframework.com/wiki/2/how-to-upload-a-file-using-a-model/

Thank you for replying. I have implemented file uploading in Yii way. I wanted to know that does User module handles this. Since I have to add this field in Profiles table and User module automatically creates form controls, so how can I use Image in User module ???

Regards

Please excuse me Sadaf, but I do not understand what you mean by that

Actually in my application, I have to save pictures of users as well. Since in yii-user module every information is saved in profile table and the forms (registration and profile modification) are generated dynamically, how can I implement the user image requirement :s

As you already stated that you did already the uploading process, what I do is normally add a field to the profile table (lets called picture) and I save the filename of the image there.

When you render the model, you just need, to include the full or relative path to the image and append the image filename, whatever its name is. This way, you can move your images wherever you wish to afterwards, and the only thing you need to change its path to the images on your code (global var :) ).

To change the forms and include the fileuploader, follow the instructions on the article I sent you and modify them to suit your upload needs.

Hi I created a Yii-User widget just for this purpose.

It’s on github:

Can’t create link, just registered to reply to this thread.

@rizky,

first, thank you for sharing your work.

i am new to yii… i have used ur extension to add a profile picture upload field to my form. The image is being uploaded and a thumb is created, but for some reason it is not being saved in the database.

Note: the related column in the db table is always empty.

Do you have an idea of what could be the problem?

Thank you!