How to insert jpeg image as a multiple choice answer option?


Author
Message
clairestein
clairestein
New Member (27 reputation)New Member (27 reputation)New Member (27 reputation)New Member (27 reputation)New Member (27 reputation)New Member (27 reputation)New Member (27 reputation)New Member (27 reputation)New Member (27 reputation)
Group: Forum Members
Posts: 2, Visits: 7
I was wondering how to use a jpeg as an option for a multiple choice question. For example, instead of options A, B, C, etc., it would have the jpeg inserted instead. Here is what I have so far:

<radiobuttons aronscale>
/ caption = "What aligns the most with you?"
/ options = (
  "A",
  "B",
  "C",
  "D",
  "E",
  "F",
  "G")

</radiobuttons>

<item picturechoice>
/ stimulusframes = ("P1.jpg", "P2.jpg", "P3.jpg", "P4.jpg", "P5.jpg", "P6.jpg", "P7.jpg")
/ stimulusframesizes = (400, 400) // Adjust the size as needed
/ validresponse = ("1", "2", "3", "4", "5", "6", "7") // valid response keys
/ response = ""
/ timeout = 10000 // 10 seconds timeout
/ stimulusdisplayduration = 0
/ trialduration = 0

<stimulus>
/ items = [picturechoice]
/ onstart = [
clearkeys(),
drawbitmap(picturechoice, "center", "center")
]
/ oninput = [
set(response, getinput())
]
/ until = [response != ""]
/ onend = [
log(response)
]

</item>
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
clairestein - 9/28/2023
I was wondering how to use a jpeg as an option for a multiple choice question. For example, instead of options A, B, C, etc., it would have the jpeg inserted instead. Here is what I have so far:

<radiobuttons aronscale>
/ caption = "What aligns the most with you?"
/ options = (
  "A",
  "B",
  "C",
  "D",
  "E",
  "F",
  "G")

</radiobuttons>

<item picturechoice>
/ stimulusframes = ("P1.jpg", "P2.jpg", "P3.jpg", "P4.jpg", "P5.jpg", "P6.jpg", "P7.jpg")
/ stimulusframesizes = (400, 400) // Adjust the size as needed
/ validresponse = ("1", "2", "3", "4", "5", "6", "7") // valid response keys
/ response = ""
/ timeout = 10000 // 10 seconds timeout
/ stimulusdisplayduration = 0
/ trialduration = 0

<stimulus>
/ items = [picturechoice]
/ onstart = [
clearkeys(),
drawbitmap(picturechoice, "center", "center")
]
/ oninput = [
set(response, getinput())
]
/ until = [response != ""]
/ onend = [
log(response)
]

</item>

What you posted there isn't Inquisit syntax, so I'm unclear on what it is supposed to do or mean.

As for displaying images as options in a radiobuttons element, you will need to make use of HTML formatting tags, i.e. <img>.

<expressions>
/ heightpx = ipart(0.1*display.canvasheight) // 10% of canvas height
</expressions>

<radiobuttons example>
/ caption = "Select one of the images:"
/ options = ("<img src=flower.jpg height=<%expressions.heightpx%>>", "<img src=bee.jpg height=<%expressions.heightpx%>>")
/ optionvalues = ("Sunflower", "Bee")
/ orientation = horizontal
</radiobuttons>

<surveypage examplepage>
/ questions = [1=example]
/ showpagenumbers = false
/ showquestionnumbers = false
</surveypage>




Attachments
flower.jpg (55 views, 85.00 KB)
bee.jpg (64 views, 59.00 KB)
clairestein
clairestein
New Member (27 reputation)New Member (27 reputation)New Member (27 reputation)New Member (27 reputation)New Member (27 reputation)New Member (27 reputation)New Member (27 reputation)New Member (27 reputation)New Member (27 reputation)
Group: Forum Members
Posts: 2, Visits: 7
Dave - 9/28/2023
clairestein - 9/28/2023
I was wondering how to use a jpeg as an option for a multiple choice question. For example, instead of options A, B, C, etc., it would have the jpeg inserted instead. Here is what I have so far:

<radiobuttons aronscale>
/ caption = "What aligns the most with you?"
/ options = (
  "A",
  "B",
  "C",
  "D",
  "E",
  "F",
  "G")

</radiobuttons>

<item picturechoice>
/ stimulusframes = ("P1.jpg", "P2.jpg", "P3.jpg", "P4.jpg", "P5.jpg", "P6.jpg", "P7.jpg")
/ stimulusframesizes = (400, 400) // Adjust the size as needed
/ validresponse = ("1", "2", "3", "4", "5", "6", "7") // valid response keys
/ response = ""
/ timeout = 10000 // 10 seconds timeout
/ stimulusdisplayduration = 0
/ trialduration = 0

<stimulus>
/ items = [picturechoice]
/ onstart = [
clearkeys(),
drawbitmap(picturechoice, "center", "center")
]
/ oninput = [
set(response, getinput())
]
/ until = [response != ""]
/ onend = [
log(response)
]

</item>

What you posted there isn't Inquisit syntax, so I'm unclear on what it is supposed to do or mean.

As for displaying images as options in a radiobuttons element, you will need to make use of HTML formatting tags, i.e. <img>.

<expressions>
/ heightpx = ipart(0.1*display.canvasheight) // 10% of canvas height
</expressions>

<radiobuttons example>
/ caption = "Select one of the images:"
/ options = ("<img src=flower.jpg height=<%expressions.heightpx%>>", "<img src=bee.jpg height=<%expressions.heightpx%>>")
/ optionvalues = ("Sunflower", "Bee")
/ orientation = horizontal
</radiobuttons>

<surveypage examplepage>
/ questions = [1=example]
/ showpagenumbers = false
/ showquestionnumbers = false
</surveypage>




Thank you so much!! When I tried to input my images as the img src, it did not link them for some reason. This is what I have:

<expressions>
/ heightpx = ipart(0.1*display.canvasheight) // 10% of canvas height
</expressions>

<radiobuttons example>
/ caption = "What aligns the most with you?"
/ options = ("<img src=P1.jpeg height=<%expressions.heightpx%>>", "<img src=P2.jpeg height=<%expressions.heightpx%>>")
/ optionvalues = ("A", "B")
/ orientation = horizontal
</radiobuttons>

<surveypage examplepage>
/ questions = [1=example]
/ showpagenumbers = false
/ showquestionnumbers = false
</surveypage>

My pictures are not loading for some reason.
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
clairestein - 9/28/2023
Dave - 9/28/2023
clairestein - 9/28/2023
I was wondering how to use a jpeg as an option for a multiple choice question. For example, instead of options A, B, C, etc., it would have the jpeg inserted instead. Here is what I have so far:

<radiobuttons aronscale>
/ caption = "What aligns the most with you?"
/ options = (
  "A",
  "B",
  "C",
  "D",
  "E",
  "F",
  "G")

</radiobuttons>

<item picturechoice>
/ stimulusframes = ("P1.jpg", "P2.jpg", "P3.jpg", "P4.jpg", "P5.jpg", "P6.jpg", "P7.jpg")
/ stimulusframesizes = (400, 400) // Adjust the size as needed
/ validresponse = ("1", "2", "3", "4", "5", "6", "7") // valid response keys
/ response = ""
/ timeout = 10000 // 10 seconds timeout
/ stimulusdisplayduration = 0
/ trialduration = 0

<stimulus>
/ items = [picturechoice]
/ onstart = [
clearkeys(),
drawbitmap(picturechoice, "center", "center")
]
/ oninput = [
set(response, getinput())
]
/ until = [response != ""]
/ onend = [
log(response)
]

</item>

What you posted there isn't Inquisit syntax, so I'm unclear on what it is supposed to do or mean.

As for displaying images as options in a radiobuttons element, you will need to make use of HTML formatting tags, i.e. <img>.

<expressions>
/ heightpx = ipart(0.1*display.canvasheight) // 10% of canvas height
</expressions>

<radiobuttons example>
/ caption = "Select one of the images:"
/ options = ("<img src=flower.jpg height=<%expressions.heightpx%>>", "<img src=bee.jpg height=<%expressions.heightpx%>>")
/ optionvalues = ("Sunflower", "Bee")
/ orientation = horizontal
</radiobuttons>

<surveypage examplepage>
/ questions = [1=example]
/ showpagenumbers = false
/ showquestionnumbers = false
</surveypage>




Thank you so much!! When I tried to input my images as the img src, it did not link them for some reason. This is what I have:

<expressions>
/ heightpx = ipart(0.1*display.canvasheight) // 10% of canvas height
</expressions>

<radiobuttons example>
/ caption = "What aligns the most with you?"
/ options = ("<img src=P1.jpeg height=<%expressions.heightpx%>>", "<img src=P2.jpeg height=<%expressions.heightpx%>>")
/ optionvalues = ("A", "B")
/ orientation = horizontal
</radiobuttons>

<surveypage examplepage>
/ questions = [1=example]
/ showpagenumbers = false
/ showquestionnumbers = false
</surveypage>

My pictures are not loading for some reason.

Images are expected to reside in the same location as the script. You'll also want to make sure the image file names are all lowercase on disk as well as in the script, otherwise you'll get problems on the web, where file names of any uploaded files are automatically converted to all lowercase for cross-platform compatibility reasons.

Beyond that, there's nothing I can say without you providing the actual images.

One final caveat: HTML tags are supported as of Inquisit version 6. You posted to the Inquisit 6 forum, so that is what I assume you are using. If, however, you are wokring with a lower version (Inquisit 5 or 4), this won't work and there's no way to use images as options in radiobuttons.
Edited 8 Months Ago by Dave
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search