Images won't load in experiment, but uploaded in resources

PennController for IBEX Forums Support Images won't load in experiment, but uploaded in resources

Tagged: ,

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #6132
    gdemeurisse
    Participant

    Hi Jeremy,

    I am having some issues uploading an image (images) into my script and getting them to display. There are no syntax errors and I have the files uploaded into my resources section and labeled correctly (corresponding with the file name) in my script. I have tried scripting it multiple ways and have made sure it is all in my “sequence” and I cannot get it to work.

    Currently, I have the script as follows:

    Sequence( "gettheid", "consent", "consent2", "consent3", "consent4", "welcome", .... " (the ellipses is not part of the script). 
    newTrial("consent",
        newText("<p> Welcome! Thank you for participating in this study. Your participation provides valuable data for the scientific study of language and is greatly appreciated. </p>")
            .settings.center()
            .print()
        ,
        newText("<p>This study is <strong>restricted to people 18 years or older.</strong> If you are under 18 years old, we kindly ask that you do not participate in this study. Please <strong>complete this study on a laptop or a computer with a keyboard.</strong> Do not use a mobile device or touch screen. </p>")
            .settings.center()
            .print()
        ,
        newText("<p>In order to participate in this study, you must read the information that follows on the next page and indicate your consent below.</p>")
            .settings.center()
            .print()
    ); 
    
    Template("InformedConsentTable.csv",
        row => newTrial("consent2",
            newImage(row.consentform)
                .settings.center()
                .print()
        ,
        newButton("continue")
            .settings.center()
            .print()
            .wait()
    ));
        
    Template("InformedConsentTable.csv",
        row => newTrial("consent3",
            newImage(row.consentform)
                .settings.center()
                .print()
        ,
        newButton("continue")
            .settings.center()
            .print()
            .wait()
    ));
        newTrial("consent4",
            newText("<p>Indicate your consent below. If you do not consent to participate, please exit out of the study now.</p>")
                .settings.center()
                .print()
        ,
            newButton("consentbutton", "I agree to participate in this study.")
                .settings.center()
                .print()
                .wait()
                .log()
    );
    
    //.log("id", getVar("subjID"));
    newTrial("welcome",
        defaultText
            .print()
        ,
        newText("<p>Welcome to the experiment! Your participation should take no more than 30 minutes. </p> <p> You will complete the experimental task in this window. It should take approximately 40 minutes.</p>").settings.center()
        ,
        newText("<p>At the end of the study you will be asked to complete a very short questionnaire, which should take about 5 minutes. </p>").settings.center()
        ,
        newButton("Start")
            .settings.center()
            .print()
            .wait()
    );

    With the script like that above, it jumps to

    newTrial("consent4",
            newText("<p>Indicate your consent below. If you do not consent to participate, please exit out of the study now.</p>")
                .settings.center()
                .print()
        ,
            newButton("consentbutton", "I agree to participate in this study.")
                .settings.center()
                .print()
                .wait()
                .log()
    );

    I’ve also tried

    newTrial("consent",
        newText("<p> Welcome! Thank you for participating in this study. Your participation provides valuable data for the scientific study of language and is greatly appreciated. </p>")
            .settings.center()
            .print()
        ,
        newText("<p>This study is <strong>restricted to native English speakers </strong> and <strong>restricted to people 18 years or older.</strong> If you are not a native English bilingual or if you are under 18 years old, we kindly ask that you do not participate in this study. Please <strong>complete this study on a laptop or a computer with a keyboard.</strong> Do not use a mobile device or touch screen. </p>")
            .settings.center()
            .print()
        ,
        newText("<p>In order to participate in this study, you must read the following information and indicate your consent below.</p>")
            .settings.center()
            .print()
        ,
        newImage("informedconsent.jpg")
            .size(400,350)
            .settings.center()
            .print()
        ,
        newButton("continue")
            .settings.center()
            .print()
            .wait()
        ,
        newImage("informedconsent2.jpg")
            .size(400,350)
            .settings.center()
            .print()
        ,
        newButton("continue")
            .settings.center()
            .print()
            .wait()
        ,
        newText("<p>Indicate your consent below. If you do not consent to participate, please exit out of the study now.</p>")
            .settings.center()
            .print()
        ,
        newButton("consentbutton", "I agree to participate in this study.")
            .settings.center()
            .print()
            .wait()
            .log()
    );
    
    //.log("id", getVar("subjID"));
    newTrial("welcome",
        defaultText
            .print()
        ,
        newText("<p>Welcome to the experiment! Your participation should take no more than 30 minutes. </p> <p> You will complete the experimental task in this window. It should take approximately 40 minutes.</p>").settings.center()
        ,
        newText("<p>At the end of the study you will be asked to complete a very short questionnaire, which should take about 5 minutes. </p>").settings.center()
        ,
        newButton("Start")
            .settings.center()
            .print()
            .wait()
    );

    and will run in the order it’s supposed to without skipping anything, but it won’t display the images; it just shows up as a blank image space.

    I’ve also tried displaying the images in a canvas and that wouldn’t load the images either. Can you spot anything wrong, or do you have any insight into why my images would fail to display if they’re uploaded in my resources section as labeled correctly in my script?

    Thank you so much!

    #6138
    Jeremy
    Keymaster

    Hi,

    Failing to preload resources that were successfully updated to your project most often results from one these things:

    • A typo in the filename, ie. check the filename of the file under Resources, and also check how it is spelled in your script and/or table
    • Still a typo matter, but maybe less obvious: case matters, pay special attention to whether the extension is lower- or upper-case
    • A typo in the column name from your table that should provide the filename (eg. row.Colunm when the actual name of that column in your table is column)
    • An unsupported format. Even if your filename ends with an extension that corresponds to a supported format, make sure that you didn’t actually save the file in a different format (eg. you saved it as a vector image but renamed is with a jpg extension—that just won’t work)

    There could be other problems that cause the same behavior you’re describing. If you’re having trouble debugging this, feel free to send me a link to your experiment at support@pcibex.net

    Also, note that the very first consent trial in your first block of code has no wait command anywhere, so it naturally won’t have time to show its content on the page before moving to the next trial. I don’t know why the trials from the Template command are not executed since they do contain a wait command, maybe your tables are empty, or you made a typo in their names

    Jeremy

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.