Welcome, Guest
Username: Password: Remember me

TOPIC: Adding an image with EM does not work?

Adding an image with EM does not work? 7 months 3 weeks ago #105678

  • orvil
  • orvil's Avatar
  • OFFLINE
  • Expert Lime
  • Posts: 104
  • Thank you received: 4
  • Karma: 4
Hi all,

currently I'm trying to add an image into a question text by using the EM.

The question text in plain html is like this:
<p>Have you seen this person recently? </p>
<p><img src="/limeSurvey/upload/surveys/123456/images/{imageList_SQ001.code}" /></p>

unfortunately the result for the image link in the question is like this:
http://www.mydomain.com/limeSurvey3/upload/surveys/123456/images/%3Cspan%20id=%27LEMtailor_Q_107_316%27%3Epicture1.jpg%3C/span%3E

- The image itself is uploaded jet, of course :)
- the expressin {imageList_SQ001.code)} standalone leads to the proper filename

Any ideas how to avoid encoding of the image-file?????
Best regards/Beste Grüße,
O. Villani
Last Edit: 7 months 3 weeks ago by orvil.
The administrator has disabled public write access.

Adding an image with EM does not work? 7 months 3 weeks ago #105689

  • orvil
  • orvil's Avatar
  • OFFLINE
  • Expert Lime
  • Posts: 104
  • Thank you received: 4
  • Karma: 4
Hm, found the reason for this behavior:

This behavior is only, when these 2 questions are displayed at once (because of using JaveScript by LS).

Once these questions are displayed separately (question-by-question, or group-by-group mode and these questions are in different groups) it will work fine.

Anyhow, I could not find a solution if I have to display these questions at once!

Any ideas for this case?

THX
Best regards/Beste Grüße,
O. Villani
The administrator has disabled public write access.

Adding an image with EM does not work? 7 months 3 weeks ago #105700

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4272
  • Thank you received: 806
  • Karma: 369
I'm confused as to how you can have subquestion codes for imageList like "image1.png".

Can you attach a small sample survey?


.
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.

Adding an image with EM does not work? 7 months 3 weeks ago #105738

  • orvil
  • orvil's Avatar
  • OFFLINE
  • Expert Lime
  • Posts: 104
  • Thank you received: 4
  • Karma: 4
Please don't be confused. The name 'imageList' is only the name of a (hidden) multiple short text question where the filenames are stored.
Best regards/Beste Grüße,
O. Villani
The administrator has disabled public write access.

Adding an image with EM does not work? 7 months 3 weeks ago #105755

  • DenisChenu
  • DenisChenu's Avatar
  • OFFLINE
  • Moderator Lime
  • Posts: 6451
  • Thank you received: 844
  • Karma: 249
If the question is in the same grpup (the same page) then it was updated each time user select another answer. Then it need the <span> .

Think best is to use something like that:
<img id="img1" src="" /><div id="srcimg1" style="display:none">{imageList_SQ001.code}</div>
<script>
$(function() {
$("#img1").attr('src','/limeSurvey/upload/surveys/123456/images/'+$("#srcimg1").text());
});
$("#question{imageList_SQ001.qid} input.radio").click(function(){
$("#img1").attr('src','/limeSurvey/upload/surveys/123456/images/'+$("#srcimg1").text());
});
</script>
Maybe some fix to do.

Denis
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.227 seconds
Donation Image