Can we optionally show images for questions

More
10 months 1 week ago #157538 by wizard2none
wizard2none created the topic: Can we optionally show images for questions
Is it possible to optionally show images for questions in a survey?

Meaning would like to conditionally show images for questions in a survey.
Some questions have text and an image (but the image is not necessary, it just enhances the survey).

Method 1:
Have a question at beginning of survey where the user gets to select a text only version or a version with images? If he/she select text-only version then images are not shown for any of the questions that follow.

Method 2:
Have the system detect the user bandwidth connection and the system decide between a text-only version and version with images. If the system decides text-only version (i.e. due to low bandwidth) then images are not shown for the questions.

Please Log in or Create an account to join the conversation.

More
10 months 1 week ago - 10 months 1 week ago #157539 by Joffm
Joffm replied the topic: Can we optionally show images for questions
Hi,
well, it is easy to realize.
Just include in your question text or in the answer options an expression like

{if(Imagequestion=="1","<img src="http://www.[path to picture]/[filename]" />","Picture of boat")}

If you have an idea how to find out the bandwith, well, it's the same:
{if(bandwidth>xxx,"<img src...","Text")}
But band width shouldn't be a big problem as you can see and test including big pictures or movies.

Of course you can add some text to the image part, as normal HTML.

Regards
Joffm
Attachments:
Last Edit: 10 months 1 week ago by Joffm. Reason: Typo

Please Log in or Create an account to join the conversation.

More
10 months 1 week ago #157540 by wizard2none
wizard2none replied the topic: Can we optionally show images for questions
Thanks for the suggestion. Sounds great, so I'm trying to check the concept.

In my question text if I place:
1) {if(1,"<img src="/upload/surveys/856746/images/AdobeStock_44437644.jpeg" />","My Picture")}

I get on the question preview the following text highlighted in Yellow surrounded by a red rectangle:
if(1, "</span><span title='' class='em-var-string'>", "My Picture")

2) {if(0,"<img src="/upload/surveys/856746/images/AdobeStock_44437644.jpeg" />","My Picture")}
I get in the question preview the following text highlighted in Yellow surrounded by a red rectangle:
if(0, "</span><span title='' class='em-var-string'>", "My Picture")

I assume there's something I'm doing wrong that's keeping the Expression Manager parsing the expression.

Please Log in or Create an account to join the conversation.

More
10 months 1 week ago #157541 by Joffm
Joffm replied the topic: Can we optionally show images for questions
Hi,
your problem is that you have double quotes inside double quotes.
Sorry, in my answer it's the same. Typo.

{if(1,"<img src="/upload/surveys/856746/images/AdobeStock_44437644.jpeg" />","My Picture")}


Should be
{if(1,"<img src='/upload/surveys/856746/images/AdobeStock_44437644.jpeg' />","My Picture")}

And to add something:
You said the pictures is only "nice to have".
So you probably can lower the quality and resolution of the pictures to avoid any problem with band width.

Joffm
The following user(s) said Thank You: DenisChenu, wizard2none

Please Log in or Create an account to join the conversation.

More
1 month 1 week ago #168418 by b1994mi
b1994mi replied the topic: Can we optionally show images for questions
Hi, I have tried it and it works on the latest version of Limesurvey that I installed on localhost.

Problem is, my uni uses Version 2.06+ Build 150911 and I can't show any image. It looks like this


any idea how?
Attachments:

Please Log in or Create an account to join the conversation.

More
1 month 1 week ago - 1 month 1 week ago #168420 by Joffm
Joffm replied the topic: Can we optionally show images for questions
There is a '>' before "habib.jpg" and the "href" is closed.

Again you have double quotes inside double quotes ("title").
You didn't show the entire statement, did you?

Or is "My Picture" the part which is displayed, if Q00011!="1".
Then the "true-part" of the if-statement is not closed.

By the way: Do you really compare with a text; remove the double quotes.


In Version 2.06 I get the following:

{if(P1==1,"<img src='/lime6/upload/surveys/293126/images/screenshot.1746.jpg' style='width: 323px; height: 157px;' />","My Picture")}


Joffm
Attachments:
Last Edit: 1 month 1 week ago by Joffm.

Please Log in or Create an account to join the conversation.

More
1 month 1 week ago - 1 month 1 week ago #168436 by b1994mi
b1994mi replied the topic: Can we optionally show images for questions
Sorry for the long reply..

So this would be my line:
{if(q1==1,"<img src='http://beautiful-indonesia.umm.ac.id/files/image/peta/Untitled(4).png'/>","My Picture")}

and all I get is this


Does this have anything to do with my uni's server tampering with the code so that the students can not have advanced HTML for the questions?


UPDATE

So this whole image with if statements fiasco is due to my need of showing a map on the question. Since the gmaps API thing (short free text) is not very intuitive for the respondents, I came up with this work around.

My goal is to have a drop down choice and every answer will show a map image so that the respondents can have better guess where he/she work.

Now, I have found out this nice website called embed-map.com that can make a gmap iframe. But, then again, the whole iframe can not be displayed with the Limesurvey of my uni's. I can still show this iframe using my localhost installed Limesurvey v3.

Here is the code that I insert:
<iframe frameborder="0" scrolling="no" src="https://www.google.com/maps/embed/v1/place?q=Kebayoran+Baru,+South+Jakarta+City,+Jakarta,+Indonesia&amp;key=AIzaSyBFw0Qbyq9zTFTd-tUY6dZWTgaQzuU17R8"></iframe>

and this is how it looks on my localhost


but this is what it looks like on my uni's Limesurvey

NOTHING! :(
Attachments:
Last Edit: 1 month 1 week ago by b1994mi.

Please Log in or Create an account to join the conversation.

More
1 month 1 week ago #168439 by holch
holch replied the topic: Can we optionally show images for questions
Looks like the WYSIWYG-Editor is adding some code there. How do you insert this? With the Code-View?

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds

Please Log in or Create an account to join the conversation.

More
1 month 1 week ago #168445 by Joffm
Joffm replied the topic: Can we optionally show images for questions
Hi,
this is what it should look like (in 2.06)
I just copied your iframe-code into my question.


And this with your other embedding:


BTW: Are you sure you have the rights to do this on this university installation?

And always remember:
After entering something like this in source code mode, never open it again.
The editor changes single quotes to double quotes; then you have the problem of double quotes inside double quotes.

Best regards
Joffm
Attachments:

Please Log in or Create an account to join the conversation.

More
1 month 1 week ago - 1 month 1 week ago #168448 by b1994mi
b1994mi replied the topic: Can we optionally show images for questions
@holch:

I entered the code after I clicked the "source" button so that I use the plain text mode (code-view). Is there any way that this is due to the superadmins from my uni? :-/

@Joffm:

I'm not quite sure what my rights are with my uni's installation. Where can I make sure of that?

I have made sure that I write in the code mode and not opening/editing the question again. It just seemed that the changes are automatic. Is it due to the WYSIWYG that holch have described?
Last Edit: 1 month 1 week ago by b1994mi.

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!