- Posts: 33
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Can we optionally show images for questions
- wizard2none
- Topic Author
- Offline
- Junior Member
Less
More
6 years 8 months ago #157538
by wizard2none
Can we optionally show images for questions was created by wizard2none
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.
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.
The topic has been locked.
- Joffm
- Away
- LimeSurvey Community Team
Less
More
- Posts: 12941
- Thank you received: 3979
6 years 8 months ago - 6 years 8 months ago #157539
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on 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
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
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Attachments:
Last edit: 6 years 8 months ago by Joffm. Reason: Typo
The topic has been locked.
- wizard2none
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 33
- Thank you received: 0
6 years 8 months ago #157540
by wizard2none
Replied by wizard2none on 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.
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.
The topic has been locked.
- Joffm
- Away
- LimeSurvey Community Team
Less
More
- Posts: 12941
- Thank you received: 3979
6 years 8 months ago #157541
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on 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.
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
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
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: DenisChenu, wizard2none
The topic has been locked.
- b1994mi
- Offline
- New Member
Less
More
- Posts: 18
- Thank you received: 4
5 years 11 months ago #168418
by b1994mi
Replied by b1994mi on topic Can we optionally show images for questions
Attachments:
The topic has been locked.
- Joffm
- Away
- LimeSurvey Community Team
Less
More
- Posts: 12941
- Thank you received: 3979
5 years 11 months ago - 5 years 11 months ago #168420
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on 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
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
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Attachments:
Last edit: 5 years 11 months ago by Joffm.
The topic has been locked.
- b1994mi
- Offline
- New Member
Less
More
- Posts: 18
- Thank you received: 4
5 years 11 months ago - 5 years 11 months ago #168436
by b1994mi
Replied by b1994mi on topic Can we optionally show images for questions
Sorry for the long reply..
So this would be my line:
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:
and this is how it looks on my localhost
but this is what it looks like on my uni's Limesurvey
NOTHING!
So this would be my line:
Code:
{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:
Code:
<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: 5 years 11 months ago by b1994mi.
The topic has been locked.
- holch
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11660
- Thank you received: 2742
5 years 11 months ago #168439
by holch
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Replied by holch on 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 answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
The topic has been locked.
- Joffm
- Away
- LimeSurvey Community Team
Less
More
- Posts: 12941
- Thank you received: 3979
5 years 11 months ago #168445
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on 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
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
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Attachments:
The topic has been locked.
- b1994mi
- Offline
- New Member
Less
More
- Posts: 18
- Thank you received: 4
5 years 11 months ago - 5 years 11 months ago #168448
by b1994mi
Replied by b1994mi on 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?
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: 5 years 11 months ago by b1994mi.
The topic has been locked.