Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Problem with preloading images with jsPsych/JATOS on server (Mindprobe)

Hi guys,

I'm sorry if I ask something really stupid, but I have no clue of how to work with servers. I've got my code on my local JATOS, and preloading images in jsPsych works alright, but when I import the experiment on the JATOS server, I get an error message:

"Error loading file: https://jatos.mindprobe.eu/publix/[file path/file name].png

File did not begin loading. Check that file path is correct and reachable by the browser, and that loading is not blocked by cross-origin resource sharing (CORS) errors."

If I inactivate the preloading part of the code, images are displayed alright in the trials, but as it is a reaction time experiment I would prefer preloading them to prevent any issues with slow internet connections etc.

My code in short is the following:

// initialize jsPsych
 var jsPsych = initJsPsych({
      on_finish: () => jatos.endStudy(jsPsych.data.get().json())
 });

// create timeline
var timeline = [];

// define array of images to preload, e.g.
var images = [
      'img1.png',
      'img2.png',
      'img3.png'
];
// preload images
var preload = {
      type: jsPsychPreload,
      images: images,
      show_detailed_errors: true,
      message: 'Please wait.'
};

   timeline.push(preload);

// here comes the code of the experiment proper

// start experiment
jatos.onLoad(function () {
      jsPsych.run(timeline)
})

I imagine it has to do with access to cache? As far as I understood, there are default specifications of temp file locations that should work alright, but apparently I need to change something here. Or maybe it is something else and, again, sorry if this is a really stupid question.

I really would appreciate your help on this topic! Thank you so much in advance for any hint!

Comments

  • Hi,

    Preloading of images should work the same way as normal loading. But maybe jsPsych does something with the URL path it uses to open the file. Where are those image files stored? What is the file structure of your experiment?

    Best

    K

  • Hi,

    Thank you so much for answering! First, I stored the image files in separate folders called "stimuli" and "practice_imgs", then I tried out putting them all directly in the experiment folder in study_assets_root. It was all the same in the two cases: images load in the experiment, but preloading fails. In the code, I use relative paths.

    In the attached pictures you can see the error message with the file path in the online experiment and the folder content in the experiment folder in study_assets_root on my computer. The different html-files are the different components of the experiment.

    Best, Ines


  • Hi Ines,

    Your file structure and the relative path you are using seem to be fine. But I could have a closer look if you agree. Can you share your study with me? The easiest would be to add user 'admin' as a member of your study. But if your study contains sensitive data you can also export it and send me a stripped-down version of it.

    Best,

    K

  • Great, thank you very much! I have just added you. The error occurs with the second component.

  • You develop your study on Windows, aren't you? Windows isn't very strict with letters and capitalization. But Mindprobe-JATOS runs on Linux and there it is. Your filename spelling must be precisely the same in your file system and the code.

     // define image array for preloading
       var images = [
           'practice_imgs/Tastaturbelegung.JPG', 
           'practice_imgs/Ablauf_mit_Fragen_neu.png',
           'practice_imgs/coffee_s1.jpg', 
           'practice_imgs/coffee_s2.jpg',
           'practice_imgs/ruecklicht_s1.jpg',
           'practice_imgs/ruecklicht_s2.jpg',
           'practice_imgs/67Fb_marbles.png',
           'practice_imgs/33SCa_chili.png',
           'practice_imgs/34NSCa_chillies.png',
           'practice_imgs/9Fb_napkin.png',
           'practice_imgs/33Fb_bucket.png'
       ];
    

    I changed coffee_s1.JPG -> coffee_s1.jpg and coffee_s2.JPG -> coffee_s2.jpg and then the second component worked with me. But to be sure I'd recommend to check all other filenames too.

    Best,

    Kristian

  • Hi Kristian,

    thank you so much! Yes, I am working on Windows. I always looked for errors in the code, and therefore I also searched the wrong questions to find the answer elsewhere in forums.... Now it works alright. Many thanks!!

    Best,

    Ines

Sign In or Register to comment.

agen judi bola , sportbook, casino, togel, number game, singapore, tangkas, basket, slot, poker, dominoqq, agen bola. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 50.000 ,- bonus cashback hingga 10% , diskon togel hingga 66% bisa bermain di android dan IOS kapanpun dan dimana pun. poker , bandarq , aduq, domino qq , dominobet. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 10.000 ,- bonus turnover 0.5% dan bonus referral 20%. Bonus - bonus yang dihadirkan bisa terbilang cukup tinggi dan memuaskan, anda hanya perlu memasang pada situs yang memberikan bursa pasaran terbaik yaitu http://45.77.173.118/ Bola168. Situs penyedia segala jenis permainan poker online kini semakin banyak ditemukan di Internet, salah satunya TahunQQ merupakan situs Agen Judi Domino66 Dan BandarQ Terpercaya yang mampu memberikan banyak provit bagi bettornya. Permainan Yang Di Sediakan Dewi365 Juga sangat banyak Dan menarik dan Peluang untuk memenangkan Taruhan Judi online ini juga sangat mudah . Mainkan Segera Taruhan Sportbook anda bersama Agen Judi Bola Bersama Dewi365 Kemenangan Anda Berapa pun akan Terbayarkan. Tersedia 9 macam permainan seru yang bisa kamu mainkan hanya di dalam 1 ID saja. Permainan seru yang tersedia seperti Poker, Domino QQ Dan juga BandarQ Online. Semuanya tersedia lengkap hanya di ABGQQ. Situs ABGQQ sangat mudah dimenangkan, kamu juga akan mendapatkan mega bonus dan setiap pemain berhak mendapatkan cashback mingguan. ABGQQ juga telah diakui sebagai Bandar Domino Online yang menjamin sistem FAIR PLAY disetiap permainan yang bisa dimainkan dengan deposit minimal hanya Rp.25.000. DEWI365 adalah Bandar Judi Bola Terpercaya & resmi dan terpercaya di indonesia. Situs judi bola ini menyediakan fasilitas bagi anda untuk dapat bermain memainkan permainan judi bola. Didalam situs ini memiliki berbagai permainan taruhan bola terlengkap seperti Sbobet, yang membuat DEWI365 menjadi situs judi bola terbaik dan terpercaya di Indonesia. Tentunya sebagai situs yang bertugas sebagai Bandar Poker Online pastinya akan berusaha untuk menjaga semua informasi dan keamanan yang terdapat di POKERQQ13. Kotakqq adalah situs Judi Poker Online Terpercayayang menyediakan 9 jenis permainan sakong online, dominoqq, domino99, bandarq, bandar ceme, aduq, poker online, bandar poker, balak66, perang baccarat, dan capsa susun. Dengan minimal deposit withdraw 15.000 Anda sudah bisa memainkan semua permaina pkv games di situs kami. Jackpot besar,Win rate tinggi, Fair play, PKV Games