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

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

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

#1 User is offline   Sadaf 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 51
  • Joined: 15-July 10
  • Location:Islamabad, Pakistan

Posted 11 January 2011 - 04:55 AM

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,
0

#2 User is offline   Antonio Ramirez 

  • Elite Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 1,448
  • Joined: 04-October 10

Posted 11 January 2011 - 05:43 AM

This may help you http://www.yiiframew...-using-a-model/
¿How long would it take for you to understand that you own nothing in this world?

www.ramirezcobos.com
www.2amigos.us
www.github.com/tonydspaniard
www.github.com/2amigos


Posted Image
0

#3 User is offline   Sadaf 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 51
  • Joined: 15-July 10
  • Location:Islamabad, Pakistan

Posted 11 January 2011 - 05:48 AM

View PostAntonio Ramirez, on 11 January 2011 - 05:43 AM, said:



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
0

#4 User is offline   Antonio Ramirez 

  • Elite Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 1,448
  • Joined: 04-October 10

Posted 12 January 2011 - 06:32 AM

Please excuse me Sadaf, but I do not understand what you mean by that
¿How long would it take for you to understand that you own nothing in this world?

www.ramirezcobos.com
www.2amigos.us
www.github.com/tonydspaniard
www.github.com/2amigos


Posted Image
0

#5 User is offline   Sadaf 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 51
  • Joined: 15-July 10
  • Location:Islamabad, Pakistan

Posted 12 January 2011 - 06:39 AM

View PostAntonio Ramirez, on 12 January 2011 - 06:32 AM, said:

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
0

#6 User is offline   Antonio Ramirez 

  • Elite Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 1,448
  • Joined: 04-October 10

Posted 12 January 2011 - 07:18 AM

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.
¿How long would it take for you to understand that you own nothing in this world?

www.ramirezcobos.com
www.2amigos.us
www.github.com/tonydspaniard
www.github.com/2amigos


Posted Image
1

#7 User is offline   rizky 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 05-September 12

Posted 07 September 2012 - 04:47 AM

Hi I created a Yii-User widget just for this purpose.
It's on github:


github.com/rizkyramadhan/yii-user-profilepic


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

#8 User is offline   beesho 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 12
  • Joined: 21-September 12

Posted 06 November 2012 - 03:17 PM

View Postrizky, on 07 September 2012 - 04:47 AM, said:

Hi I created a Yii-User widget just for this purpose.
It's on github:


github.com/rizkyramadhan/yii-user-profilepic


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!
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users