News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

How do you include icons with custom profile fields?

Started by Random Username, January 12, 2023, 04:39:28 AM

Previous topic - Next topic

Random Username

I can't seem to find where to add/upload the images nor connect them to options in registration fields.

Thank you!

Kindred

you can upload them anywhere -- as long as you call out the correct location in your field definition.

In general, I'd suggest loading them to Themes/default/images
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Random Username

Is it possible you might provide an example of a field definition calling an image? I really appreciate it. Sorry I know so little.

GL700Wing

#3
1.  Resize images to required display dimensions and save to a folder/directory with read permissions for everyone.
2.  Create a custom profile field with the following in the 'Show Enclosed Within Text (Optional):' text box:
<img src="https://mywebsite.com/forum/cpf_images/{INPUT}.jpg" alt="{INPUT}"></img>where 'mywebsite.com/forum/cpf_images' is the full pathname of the folder/directory the images were saved to in Step 1.
3. Select 'Radio Button' as the 'Field Type'.
4.  Create an option for each of the images that can be selected - this is the case-sensitive filename without the filename suffix (eg, .jpg).


As per the example shown in the attached images JPG images of some actors were copied to the cpf_images folder/directory and a custom profile field was created to display an image on the topic view (and also in the profile).
You cannot view this attachment.You cannot view this attachment.You cannot view this attachment.   
Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

Random Username


Steve

So this topic can be marked solved then? Or do you still have questions regarding this?
My pet rock is not feeling well. I think it's stoned.

Random Username

Hi, had question but solution came to my typing it out. Added {INPUT} to the beginning of the code in the "Show Enclosed Within Text (Optional):" to provide a text label next to each icon when displayed in posts.

Thank you very much.

Random Username

I'm afraid I marked it solves a ta early. I can't seem to capitalize the first letter of my text labels. I would appreciate a tad more help here, pretty please.  8)

Thank you

Random Username


Random Username

Follow up question: How can I include spaces within the label for each icon!

Thank you again!

Random Username

So I set up a flag for every country. It's super cool, showing a flag in their profile and memberlist. But it would be a lot more polished if I could include spaces in the country names. Currently the country name must match the filename to call the image. When it's done, I will share it as a modification package, though I might need a bit of help there too, I'm afraid. Still, it should save people the tedious work. Here is what I have now:

{INPUT} <img src="https://mysite/Themes/default/images/countries/{INPUT}.png" alt="{INPUT}"/>
The popup instructions include this, and I've tried playing with it to no avail: {KEY} - Used when a field has multiple options, is the unique numeric ID used to identify it.

I'd super appreciate a bit more help.



Advertisement: