The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

Is it possible for the user to put an image in the contact field?

View previous topic View next topic Go down

Solved Is it possible for the user to put an image in the contact field?

Post by Hert on July 10th 2015, 10:56 pm

Hello,

I'm sorry the title is a bit vague, but I really didn't know what to put there.

I was wondering if it's in anyway possible for an user to put in an URL of image, for example the contact fields, and that it will show up in the poster profile?
I've tried something like this:<img src="{postrow.displayed.contact_field.CONTENT}" /> (display > templates > general > viewtopic_body), but sadly that does not work.

Maybe it's possible with some script, but I have no knowledge of things like that. So I was wondering if it was just possible or not?

Greetings,
Hert


Last edited by Hert on July 12th 2015, 2:27 pm; edited 1 time in total

Hert
Forumember

Posts : 81
Reputation : 3
Language : Dutch and English

http://afterthefall.actieforum.com/

Back to top Go down

Solved Re: Is it possible for the user to put an image in the contact field?

Post by Ange Tuteur on July 11th 2015, 11:08 am

Hi @Hert,

It's possible. The contact fields are usually anchor elements, with a child image element. If you don't have an image for the field, then it will have an image with an empty src, but the alt will be the value you submitted. You could do something like this to change it to an image :
Code:
$(function() {
  for (var a = document.getElementsByTagName('A'), i = 0, j = a.length, c; i < j; i++) {
    c = a[i].firstChild;
    if (c && c.tagName == 'IMG' && a[i].href == c.alt) c.src = c.alt;
  }
});
( I'd set the script above in the topics )

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: Is it possible for the user to put an image in the contact field?

Post by Hert on July 11th 2015, 11:15 pm

Hi @Ange Tuteur, thank you very much for your script - it works!

I was, however, wondering if I could set the size of the image (to prevent people from using too big ones) - I've tried adding a div and a class to it, but that doesn't seem to work.
Maybe you also know how to solve this ^^ ?

Hert
Forumember

Posts : 81
Reputation : 3
Language : Dutch and English

http://afterthefall.actieforum.com/

Back to top Go down

Solved Re: Is it possible for the user to put an image in the contact field?

Post by SLGray on July 12th 2015, 4:16 am

Please change the title of your topic to something that is related to your question/issue, so that other users will be able to find their question/issue using the search engine.


When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.


SLGray
Administrator
Administrator

Male Posts : 36639
Reputation : 2441
Language : English
Location : United States

http://ztwds.forumotion.com/

Back to top Go down

Solved Re: Is it possible for the user to put an image in the contact field?

Post by Ange Tuteur on July 12th 2015, 10:37 am

You could also add a class to the image with javascript so you can resize it with CSS. Here's the updated script :
Code:
$(function() {
  for (var a = document.getElementsByTagName('A'), i = 0, j = a.length, c; i < j; i++) {
    c = a[i].firstChild;
    if (c && c.tagName == 'IMG' && a[i].href == c.alt) {
      c.src = c.alt;
      c.className += ' contactImage';
    }
  }
});

Example with CSS :
Code:
.contactImage {
  max-width:150px;
  max-height:100px;
}

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: Is it possible for the user to put an image in the contact field?

Post by Hert on July 12th 2015, 2:26 pm

Thank you once again ^^

Well, that solves it!

(I don't think it's still necessary to change the title since it's solved already, right?)

Hert
Forumember

Posts : 81
Reputation : 3
Language : Dutch and English

http://afterthefall.actieforum.com/

Back to top Go down

Solved Re: Is it possible for the user to put an image in the contact field?

Post by SLGray on July 12th 2015, 6:54 pm

Topic solved and archived


When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.


SLGray
Administrator
Administrator

Male Posts : 36639
Reputation : 2441
Language : English
Location : United States

http://ztwds.forumotion.com/

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum