Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Display Pictures without replacement in different question groups

  • KatharinaFietz
  • KatharinaFietz's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
3 months 2 weeks ago #266717 by KatharinaFietz
Please help us help you and fill where relevant:
LimeSurvey version: 6.6.2
Own server or LimeSurvey Cloud:
Survey theme/template:
==================
Hello!

I am trying to design a choice experiment where participants are supposed to choose between two different choice cards based on pictures shown to them.

The participants are supposed to play several rounds (choose between 10 different sets of choice cards).

I am facing problems when trying to generate a variable in the first question that indicates which pictures have been used to filter the available images in the second question and only use those that have not been used. 

I am using the code below and face the following issue: Pictures in question 1 are displayed; however, in question 2, I do not see pictures (just an empty table based on the code below). In an ideal case, I would use the general setting "question by group" as a format to align it with other survey questions. In other words, the 1st question with foto1 & foto2 should be shown in Question Group 1, the 2nd question with Choice foto3 & foto4 should be shown in Question Group 2, etc.

Code Question 1:

<meta charset="UTF-8">
<title></title>
<script type="text/javascript">
    // Function to randomize tone numbers in URLs
    function getRandomPic() {
        return Math.floor(Math.random() * 3) + 1;
    }

    var availablePhotos = [
        "https://..." + getRandomPic() + ".jpg", 
        "https://..." + getRandomPic() + ".jpg",
        ...
        "https://..." + getRandomPic() + ".jpg"
    ];

    // Shuffle the photos
    function shuffleArray(array) {
        for (var i = array.length - 1; i > 0; i--) {
            var j = Math.floor(Math.random() * (i + 1));
            var temp = array;
            array = array[j];
            array[j] = temp;
        }
    }
    shuffleArray(availablePhotos);

    // Function to assign photos for two choice cards for a group
    function assignChoiceCards(remainingPhotos, photosPerCard, numChoiceCards) {
        var choiceCards = [];
        for (var i = 0; i < numChoiceCards; i++) {
            choiceCards = remainingPhotos.splice(0, photosPerCard); // Each card gets 'photosPerCard' photos
        }
        return choiceCards;
    }

    // Assign photos for question 1
    var choiceCards1 = assignChoiceCards(availablePhotos, 6, 2); // Group 1 gets 2 choice cards, with 6 photos each

    // Store the used images in hidden input fields
    var usedPhotos = choiceCards1.flat().join('|');
    document.write('<input type="hidden" id="usedPhotos" name="usedPhotos" value="' + usedPhotos + '" />');

    // Inject the images into the HTML
    function injectImages() {
        document.getElementById("foto1_img1").src = choiceCards1[0][0];
        document.getElementById("foto1_img2").src = choiceCards1[0][1];
        document.getElementById("foto1_img3").src = choiceCards1[0][2];
        document.getElementById("foto1_img4").src = choiceCards1[0][3];
        document.getElementById("foto1_img5").src = choiceCards1[0][4];
        document.getElementById("foto1_img6").src = choiceCards1[0][5];

        document.getElementById("foto2_img1").src = choiceCards1[1][0];
        document.getElementById("foto2_img2").src = choiceCards1[1][1];
        document.getElementById("foto2_img3").src = choiceCards1[1][2];
        document.getElementById("foto2_img4").src = choiceCards1[1][3];
        document.getElementById("foto2_img5").src = choiceCards1[1][4];
        document.getElementById("foto2_img6").src = choiceCards1[1][5];
    }

    $(document).on('ready pjax:scriptcomplete', function() {
        injectImages(); // Inject images when the page loads
    });
</script>
<p style="height: 6px; text-align: center;"> </p>

<table border="1" bordercolor="#ccc" cellpadding="5" cellspacing="0" style="width:1120px;">
    <tbody>
        <tr>
            <td style="text-align: center;" width="0%"> </td>
            <td style="text-align: center;" width="0%"> </td>
            <td bgcolor="#D4D7E4" style="text-align: center;" width="40%">
            <p><span style="font-size:14px;"><span style="font-family:Arial,Helvetica,sans-serif;"><strong>Choice 1</strong></span></span></p>
            </td>
            <td style="text-align: center;" width="0%"> </td>
            <td bgcolor="#D4D7E4" style="text-align: center;" width="40%">
            <p><span style="font-size:14px;"><span style="font-family:Arial,Helvetica,sans-serif;"><strong>Choice 2</strong></span></span></p>
            </td>
        </tr>
        <tr>
            <td bgcolor="#f2f2f2" style="text-align: center;"><span style="font-size:14px;"><span style="font-family:Arial,Helvetica,sans-serif;">Fotos</span></span></td>
            <td style="text-align: center;" width="1%"> </td>
            <td bgcolor="#f2f2f2" style="text-align: center;">
            <table align="center" border="0" cellpadding="0" cellspacing="0" style="width:350px;">
                <tbody>
                    <tr>
                        <td>
                        <p><span style="font-size:14px;"><img id="foto1_img1" style="width: 80px;" /> </span></p>
                        </td>
                        <td>
                        <p><span style="font-size:14px;"><img id="foto1_img2" style="width: 80px;" /></span></p>
                        </td>
                        <td>
                        <p><span style="font-size:14px;"><img id="foto1_img3" style="width: 80px;" /></span></p>
                        </td>
                    </tr>
                    <tr>
                        <td>
                        <p><span style="font-size:14px;"><img id="foto1_img4" style="width: 80px;" /></span></p>
                        </td>
                        <td>
                        <p><span style="font-size:14px;"><img id="foto1_img5" style="width: 80px;" /></span></p>
                        </td>
                        <td>
                        <p><span style="font-size:14px;"><img id="foto1_img6" style="width: 80px;" /></span></p>
                        </td>
                    </tr>
                </tbody>
            </table>
            </td>
            <td style="text-align: center;" width="1%"> </td>
            <td bgcolor="#f2f2f2" style="text-align: center;">
            <table align="center" border="0" cellpadding="1" cellspacing="1" style="width:400px;">
                <tbody>
                    <tr>
                        <td>
                        <p><span style="font-size:14px;"><img id="foto2_img1" style="width: 80px;" /></span></p>
                        </td>
                        <td>
                        <p><span style="font-size:14px;"><img id="foto2_img2" style="width: 80px;" /></span></p>
                        </td>
                        <td>
                        <p><span style="font-size:14px;"><img id="foto2_img3" style="width: 80px;" /></span></p>
                        </td>
                    </tr>
                    <tr>
                        <td>
                        <p><span style="font-size:14px;"><img id="foto2_img4" style="width: 80px;" /></span></p>
                        </td>
                        <td>
                        <p><span style="font-size:14px;"><img id="foto2_img5" style="width: 80px;" /></span></p>
                        </td>
                        <td>
                        <p><span style="font-size:14px;"><img id="foto2_img6" style="width: 80px;" /></span></p>
                        </td>
                    </tr>
                </tbody>
            </table>
            </td>
        </tr>
    </tbody>
</table>

Code Question 2:

<meta charset="UTF-8">
<title></title>
<script type="text/javascript">
    // Function to randomize tone numbers in URLs
    function getRandomPic() {
        return Math.floor(Math.random() * 3) + 1;
    }

    var availablePhotos = [
   "https://..." + getRandomPic() + ".jpg", 
        "https://..." + getRandomPic() + ".jpg",
        ...
        "https://..." + getRandomPic() + ".jpg"
    ];


    // Retrieve the used photos from question 1 (from hidden input field)
    var usedPhotos = "{INSERT:usedPhotos}";
    var usedPhotosArray = usedPhotos.split('|');

    // Remove used photos from the availablePhotos array
    availablePhotos = availablePhotos.filter(function(photo) {
        return !usedPhotosArray.includes(photo);
    });


    // Shuffle the remaining photos
    function shuffleArray(array) {
        for (var i = array.length - 1; i > 0; i--) {
            var j = Math.floor(Math.random() * (i + 1));
            var temp = array;
            array = array[j];
            array[j] = temp;
        }
    }
    shuffleArray(availablePhotos);

    // Assign photos for question 2
    var choiceCards2 = assignChoiceCards(availablePhotos, 6, 2); // Group 2 gets 2 choice cards, with 6 photos each

    // Inject the images into the HTML
    function injectImages() {
        document.getElementById("foto3_img1").src = choiceCards2[0][0];
        document.getElementById("foto3_img2").src = choiceCards2[0][1];
        document.getElementById("foto3_img3").src = choiceCards2[0][2];
        document.getElementById("foto3_img4").src = choiceCards2[0][3];
        document.getElementById("foto3_img5").src = choiceCards2[0][4];
        document.getElementById("foto3_img6").src = choiceCards2[0][5];

        document.getElementById("foto4_img1").src = choiceCards2[1][0];
        document.getElementById("foto4_img2").src = choiceCards2[1][1];
        document.getElementById("foto4_img3").src = choiceCards2[1][2];
        document.getElementById("foto4_img4").src = choiceCards2[1][3];
        document.getElementById("foto4_img5").src = choiceCards2[1][4];
        document.getElementById("foto4_img6").src = choiceCards2[1][5];
    }

    $(document).on('ready pjax:scriptcomplete', function() {
        injectImages(); // Inject images when the page loads
    });
</script>
<table border="1" bordercolor="#ccc" cellpadding="5" cellspacing="0" style="width:1120px;">
    <tbody>
        <tr>
            <td style="text-align: center;" width="0%">
            <p> </p>
            </td>
            <td style="text-align: center;" width="0%">
            <p> </p>
            </td>
            <td bgcolor="#D4D7E4" style="text-align: center;" width="40%">
            <p><span style="font-size:14px;"><span style="font-family:Arial,Helvetica,sans-serif;"><strong>Choice 1</strong></span></span></p>
            </td>
            <td style="text-align: center;" width="0%">
            <p> </p>
            </td>
            <td bgcolor="#D4D7E4" style="text-align: center;" width="40%">
            <p><span style="font-size:14px;"><span style="font-family:Arial,Helvetica,sans-serif;"><strong>Choice 2</strong></span></span></p>
            </td>
        </tr>
        <tr>
            <td bgcolor="#f2f2f2" style="text-align: center;"><span style="font-size:14px;"><span style="font-family:Arial,Helvetica,sans-serif;">Fotos</span></span></td>
            <td style="text-align: center;" width="1%"> </td>
            <td bgcolor="#f2f2f2" style="text-align: center;">
            <table align="center" border="0" cellpadding="0" cellspacing="0" style="width:350px;">
                <tbody>
                    <tr>
                        <td>
                        <p><span style="font-size:14px;"><img id="foto3_img1" style="width: 80px;" /> </span></p>
                        </td>
                        <td>
                        <p><span style="font-size:14px;"><img id="foto3_img2" style="width: 80px;" /></span></p>
                        </td>
                        <td>
                        <p><span style="font-size:14px;"><img id="foto3_img3" style="width: 80px;" /></span></p>
                        </td>
                    </tr>
                    <tr>
                        <td>
                        <p><span style="font-size:14px;"><img id="foto3_img4" style="width: 80px;" /></span></p>
                        </td>
                        <td>
                        <p><span style="font-size:14px;"><img id="foto3_img5" style="width: 80px;" /></span></p>
                        </td>
                        <td>
                        <p><span style="font-size:14px;"><img id="foto3_img6" style="width: 80px;" /></span></p>
                        </td>
                    </tr>
                </tbody>
            </table>
            </td>
            <td style="text-align: center;" width="1%"> </td>
            <td bgcolor="#f2f2f2" style="text-align: center;">
            <table align="center" border="0" cellpadding="1" cellspacing="1" style="width:400px;">
                <tbody>
                    <tr>
                        <td>
                        <p><span style="font-size:14px;"><img id="foto4_img1" style="width: 80px;" /></span></p>
                        </td>
                        <td>
                        <p><span style="font-size:14px;"><img id="foto4_img2" style="width: 80px;" /></span></p>
                        </td>
                        <td>
                        <p><span style="font-size:14px;"><img id="foto4_img3" style="width: 80px;" /></span></p>
                        </td>
                    </tr>
                    <tr>
                        <td>
                        <p><span style="font-size:14px;"><img id="foto4_img4" style="width: 80px;" /></span></p>
                        </td>
                        <td>
                        <p><span style="font-size:14px;"><img id="foto4_img5" style="width: 80px;" /></span></p>
                        </td>
                        <td>
                        <p><span style="font-size:14px;"><img id="foto4_img6" style="width: 80px;" /></span></p>
                        </td>
                    </tr>
                </tbody>
            </table>
            </td>
        </tr>
    </tbody>
</table>

My apologies if I missed any information that should have been provided.

Any help is very much appreciated!

Thank you very much in advance! 

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 months 2 weeks ago - 3 months 2 weeks ago #266721 by Joffm
Hi,
seeing your HTML structure I suppose you use this "green apple - banana" exqample. Well there are better implementations of this.

But about your images: Where did you find this code?

Your username lets me think you are able to read German.
The easy way you find in my "Tutorial 4: Gleichungen, Zufall", Chapter 3.2.1.
Here we select 5 out of 500, you select 20 out of 20 (the same)

Question of type "multiple short text" and this script in the source
Code:
<script type="text/javascript" charset="utf-8">function shuffle(array) {
  var currentIndex = array.length, temporaryValue, randomIndex;
  // While there remain elements to shuffle...
  while (0 !== currentIndex) {
    // Pick a remaining element...
    randomIndex = Math.floor(Math.random() * currentIndex);
    currentIndex -= 1;
    // And swap it with the current element.
    temporaryValue = array[currentIndex];
    array[currentIndex] = array[randomIndex];
    array[randomIndex] = temporaryValue;
  }
  return array;
}$(document).on('ready pjax:scriptcomplete',function(){
  // Fill the array, hier Zahlen von 1 - 20
  var arr = ;
  for (var i = 1; i < 21; i++) {
  arr.push(i);
}
 
arr = shuffle(arr);
$('#question{QID} input[type="text"]:eq(0)').val(arr[0]);
$('#question{QID} input[type="text"]:eq(1)').val(arr[1]);
$('#question{QID} input[type="text"]:eq(2)').val(arr[2]);
$('#question{QID} input[type="text"]:eq(3)').val(arr[3]);
$('#question{QID} input[type="text"]:eq(4)').val(arr[4]);
...
$('#question{QID} input[type="text"]:eq(19)').val(arr[19]);
$('#question{QID}').hide();
});
</script>

This you find in the German section on page 12, 13, 14, (just have a look)
Here you shuffle your images

And an easier way to display the images is
rename the images to "image1.jpg", "image2.jpg", ..., "image20.jpg"
and display directly in your HTML code
Code:
<td>
     <img src="PathToImage/image{QPool_1}.jpg" /> 
</td>

Joffm

P.S.
Some better implementations you may find in my "Tutorial 3: Gimmicks", Chapter 11, where you also see the "apple - banana" example.
 

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 3 months 2 weeks ago by Joffm.

Please Log in to join the conversation.

  • KatharinaFietz
  • KatharinaFietz's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
3 months 2 weeks ago #266727 by KatharinaFietz
 Thank you, Joffm! My apologies that I still have a follow-up question, however, I am still struggling to not have the same pictures in question 1 and 2. 

I adapted my code based on your guidance - thank you.

However, the pictures are repeating between questions 1 & 2.

Code Question 1:

<script type="text/javascript" charset="utf-8">
function shuffle(array) {
    var currentIndex = array.length, temporaryValue, randomIndex;
    // While there remain elements to shuffle...
    while (0 !== currentIndex) {
        // Pick a remaining element...
        randomIndex = Math.floor(Math.random() * currentIndex);
        currentIndex -= 1;
        // And swap it with the current element.
        temporaryValue = array[currentIndex];
        array[currentIndex] = array[randomIndex];
        array[randomIndex] = temporaryValue;
    }
    return array;
}

    // Function to randomize tone numbers in URLs
    function getRandomPic() {
        return Math.floor(Math.random() * 3) + 1;
    }

    var availablePhotos = [
        "https://..." + getRandomPic() + ".jpg", 
        "https://..." + getRandomPic() + ".jpg",
        ...
        "https://..." + getRandomPic() + ".jpg"
    ];
  
    availablePhotos = shuffle(availablePhotos); // Shuffle the photos

    // Inject the shuffled images into the HTML
    $('#question443 img:eq(0)').attr('src', availablePhotos[0]);
    $('#question443 img:eq(1)').attr('src', availablePhotos[1]);
    $('#question443 img:eq(2)').attr('src', availablePhotos[2]);
    $('#question443 img:eq(3)').attr('src', availablePhotos[3]);
    $('#question443 img:eq(4)').attr('src', availablePhotos[4]);
    $('#question443 img:eq(5)').attr('src', availablePhotos[5]);

   
});
</script>
<table>
    <tbody>
        <tr>
            <td><img alt="Image 1" src="" style="width: 80px;" /></td>
            <td><img alt="Image 2" src="" style="width: 80px;" /></td>
            <td><img alt="Image 3" src="" style="width: 80px;" /></td>
        </tr>
        <tr>
            <td><img alt="Image 4" src="" style="width: 80px;" /></td>
            <td><img alt="Image 5" src="" style="width: 80px;" /></td>
            <td><img alt="Image 6" src="" style="width: 80px;" /></td>
        </tr>
    </tbody>
</table>


Code Question 2:

<script type="text/javascript" charset="utf-8">
function shuffle(array) {
    var currentIndex = array.length, temporaryValue, randomIndex;
    // While there remain elements to shuffle...
    while (0 !== currentIndex) {
        // Pick a remaining element...
        randomIndex = Math.floor(Math.random() * currentIndex);
        currentIndex -= 1;
        // And swap it with the current element.
        temporaryValue = array[currentIndex];
        array[currentIndex] = array[randomIndex];
        array[randomIndex] = temporaryValue;
    }
    return array;
}

    // Function to randomize tone numbers in URLs
    function getRandomPic() {
        return Math.floor(Math.random() * 3) + 1;
    }

    var availablePhotos = [
        "https://..." + getRandomPic() + ".jpg", 
        "https://..." + getRandomPic() + ".jpg",
        ...
        "https://..." + getRandomPic() + ".jpg"
    ];



    availablePhotos = shuffle(availablePhotos); // Shuffle the remaining photos

    // Inject the shuffled images into the HTML for Question 2
    $('#question444 img:eq(0)').attr('src', availablePhotos[6]);
    $('#question444 img:eq(1)').attr('src', availablePhotos[7]);
    $('#question444 img:eq(2)').attr('src', availablePhotos[8]);
    $('#question444 img:eq(3)').attr('src', availablePhotos[9]);
    $('#question444 img:eq(4)').attr('src', availablePhotos[10]);
    $('#question444 img:eq(5)').attr('src', availablePhotos[11]);

    // Show the question with images
    $('#question444').show(); 
});
</script><!-- HTML structure for displaying images in Question 2 -->
<table>
    <tbody>
        <tr>
            <td><img alt="Image 7" src="" style="width: 80px;" /></td>
            <td><img alt="Image 8" src="" style="width: 80px;" /></td>
            <td><img alt="Image 9" src="" style="width: 80px;" /></td>
        </tr>
        <tr>
            <td><img alt="Image 10" src="" style="width: 80px;" /></td>
            <td><img alt="Image 11" src="" style="width: 80px;" /></td>
            <td><img alt="Image 12" src="" style="width: 80px;" /></td>
        </tr>
    </tbody>
</table>

I adapted the way to display photos, thank you!

And again, apologies if I missed something explained in the guide with regard to not having the same pictures shown in question 1 & 2.

Thank you in advance and best!

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 months 2 weeks ago #266728 by Joffm
Not the same pictures?
No problem.
You see how you select images. Nust adappt.

But of course better:
Show the workflow.
Send the lss export.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

  • KatharinaFietz
  • KatharinaFietz's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
3 months 2 weeks ago #266729 by KatharinaFietz
Thank you very much, Joffm. Yes, sorry if I was not clear: I have two sets of choice cards and I don't want the pictures to be repeated at all. In other words, I want to show 12 different pictures and I am struggling to not repeat the pictures between question groups.

Please see the lss output attached - thank you very much in advance!

Best!

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 months 2 weeks ago #266732 by Joffm
Oh, there are many mistakes and misunderstandings.
You only use a question of type "equation" Where do you want the respondent to enter his answer?
If you use this "apple - banana" example, meaning "some kind of conjoint" you have to use a question of type "array" where you display the "cards" and receive the answer.

But you wrote

where participants are supposed to choose between two different choice cards based on pictures shown to them.

Does it mean, there are several pictures on one card? According to your code there are 6 pictures on one card.

The participants are supposed to play several rounds (choose between 10 different sets of choice cards).

This is repeated 10 times, with always different variations of the cards.

Well, that's exactly what I showed already.

In the question of type "multiple short text" you create 10 different variations of the 12 pictures.
My pictures are named
picture01.jpg
picture02.jpg
picture03.jpg
...
Therefore I used an array with the elements "01", "02",...;"12" which is shuffled several (10) times.

You get something like
 
Now with the function "substr(QCode,start,length)" you capture the 1st, 2nd, 3rd, ... number of the picture.

You display the first six pictures on the first card, the second 6 on the second card, and so on.
Like this:
1st round
 

2nd round
 

In the sample survey there is each question twice.
One with a bootstrap table and the grid layout, the other with bootstrap card groups.

But layout is up to you.

 

File Attachment:

File Name: limesurvey...21_J.lss
File Size:74 KB

Joffm


 

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

  • KatharinaFietz
  • KatharinaFietz's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
3 months 2 weeks ago #266736 by KatharinaFietz
Hi Joffm,

Thank you again! This is already very helpful. 

On the first point, I want to display all questions per question group. After the choice card, we have a question (not sent in the example - sorry), that asks which card do you prefer? 1 or 2? This is supposed to be an extra attention check. Therefore, the choice cards may be shown as equations.

Now, thank you for the example you provided, and I am sorry that I still did not explain what I want to do. However, pictures should not repeat between the 1st round (as you call it) and the 2nd round (as you call it below).

My problem is not that I have repeating pictures between the two cards of one round; my problem is that I have repeating pictures between rounds. In the end I will have 120 pictures (in each question shown 12 and this repeated 10 times).

Thank you very much for all the help already and I would really appreciate if you could assist me further even though I misexplained myself above!

Thank you and best

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 months 2 weeks ago #266738 by Joffm
So, ewhat?
You know the generalapproach to select diferent pictures.

Then split the question, put them into different groups. This is not the big problem, as long as you have your 12 picturtes shuffled.
G1

G2


 

File Attachment:

File Name: limesurvey...4182.lss
File Size:61 KB


Joffm
 

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

  • KatharinaFietz
  • KatharinaFietz's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
3 months 2 weeks ago #266741 by KatharinaFietz
Thank you - this is exactly what I need!

I am very sorry, but (hopefully) last question - how do I change the images to my images? I tried to insert my links and also include images instead of the text in the table, however, my images are not getting displayed. Do you have an idea what I could be doing wrong?

Thank you so much and best
Katharina

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 months 2 weeks ago #266742 by Joffm
No idea.
If you change the script I provided, it's your turn.

The script ONLY creates a random order of 12 two digit numbers.

And the pictures are inserted here
Code:
...
  <div class="col">
            <img style="width:30%"; src="https://www.mysurvey.de/userfiles/Hamburg-Ballett_{substr(QPool_1,0,2)}.jpg"/>
            <img style="width:30%"; src="https://www.mysurvey.de/userfiles/Hamburg-Ballett_{substr(QPool_1,2,2)}.jpg"/>
            <img style="width:30%"; src="https://www.mysurvey.de/userfiles/Hamburg-Ballett_{substr(QPool_1,4,2)}.jpg"/>
  </div>
...

You see that the filename of the picture is generated by ExpressionScript with the necessary substring.


If you insist in using your script, aorry, I am out.

Joffm

 

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

  • KatharinaFietz
  • KatharinaFietz's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
3 months 2 weeks ago #266758 by KatharinaFietz
Sorry, that was a misunderstanding! I did not mean to change your code; I was just trying to understand where exactly I need to insert the path of my pictures. In your question Q1a, you have the code below, and I am unsure where I need to insert my https path...

Again, apologies for changing your code earlier, I thought that was the way to go but I would appreciate your support on this question!

Thank you very much and best
Katharina

<table class="table" width="100%">
    <tbody>
        <tr>
            <td>
            <div class="container text-center">
            <div class="row">
            <div class="col"> </div>

            <div class="col"><img style="width:30%" /> <img style="width:30%" /> <img style="width:30%" /></div>

            <div class="col"> </div>
            </div>

            <div class="row">
            <div class="col"> </div>

            <div class="col"><img style="width:30%" /> <img style="width:30%" /> <img style="width:30%" /></div>

            <div class="col"> </div>
            </div>
            </div>
            </td>
        </tr>
    </tbody>
</table>
 

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 months 2 weeks ago #266760 by Joffm
Sorry, I do not understand.
I sent you a working example where you see the script to select the order and the way to display.

Here you see how to insert your pictures.
Code:
<div class="col">
<img style="width:30%"; src="https://www.mysurvey.de/userfiles/Hamburg-Ballett_{substr(QPool_1,0,2)}.jpg"/>
<img style="width:30%"; src="https://www.mysurvey.de/userfiles/Hamburg-Ballett_{substr(QPool_1,2,2)}.jpg"/>
<img style="width:30%"; src="https://www.mysurvey.de/userfiles/Hamburg-Ballett_{substr(QPool_1,4,2)}.jpg"/>
</div>

As I wrote before my pictures are named
Hamburg-Ballett_01.jpg
Hamburg-Ballett_02.jpg
...
Hamburg-Ballett_12.jpg
The path leads to the folder on my server (well, not exactly my server)
and {substr(QPool_1,x,2)} adds exactly the respective number of the generated string in QPool.

I do not understand your problem.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose