131 Posts
layonill
5 years ago
7
Topic

hi, I have 2 questions about the image field, number 1, you know that when you have users, and this users have a profile, there is a picture, and when the user does not upload a profile picture, what appears is this

 

this indicates there is no image yet, so, when my users don't have a profile image, how do I do to make that one appear when there is no image? to set that one as default in case there is no image?

the second question, let's say I have a comment system (one I build without the comment app, and, I use the comment example to make more clear the idea, but applies to ohter stuff) let's say I have a comment system, like in every web, or social network, when you leave a comment, your profile picture appears, if my comment input system is built as a form, I do I make the field upload image to drag the user picture as the value  (or to drag for example the image value of the current article cover), so when it is submitted it appears the comment and the thumbnail of the user profile picture?

thanks

Get a VIP membership
131 Posts
layonill
5 years ago
0
Level 1

do you know how?

1283 Posts
Bucklash
5 years ago
4
Level 1

Hi

For 1

maybe this : a conditional ie if image is empty (no value) hide field and display other field instead... if no success with that then a position override with php code to do the same trick.

For 2 

maybe this gives an idea nit not sure what you mean by drag (if move image across screen then I have no idea) https://www.jamesmorrell.com/blog/add-author-avatars-to-list-items

131 Posts
layonill
5 years ago
3
Level 2

when I say drag I mean like the one in red, so if I submit a form (using the comment as a example) it can give me the profile picture as a value once is submited the form and the info is showed, is like, it shows me the profile picture field of the owner of that comment article

1283 Posts
Bucklash
5 years ago
2
Level 3

That will probably use live value (2) sql query using $user->id to get current user and pull in the appropriate image, there are probably other ways but that would do it

131 Posts
layonill
5 years ago
1
Level 4

but I will use that where, in an user id field, or image upload field?

1283 Posts
Bucklash
5 years ago
0
Level 5

Actually

If I wanted to show an image of the current user...

  1. I would create a search and List type
    1. field: user_id (access registered)
      1. field: user_id_2 (access guest)
      2. live value (user_id): current user->id
      3. live value (user_id_2): no live value or maybe a "demo/test" user id
      4. list view have a field that gets the users avatar (in #__cck_store_item_users
      5. Render it with typo->html
      6. and apply html is required
    2. Then I would add this search and list type to the form using list field

    131 Posts
    layonill
    5 years ago
    0
    Level 1

    does somebody know about the default value of the image upload that I mentioned? I need that

    Get a Book for SEBLOD