-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
preload() hangs on loadImage #674
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
i'm not able to reproduce this! the following sketch works for me: https://editor.p5js.org/cassie/sketches/SJlIk0WUPX can you add a link to your sketch? thanks! |
Weird, it is working for me now as well, your sketch and mine. No longer an issue. thanks |
Sorry for re-opening this, but I was able to reproduce this. In preload(), I'm loading 15 images into an array like so: for (var i = 0; i < numOfImages; i++) {
imgs[i] = loadImage("images/" + i + "_image.png");
} and draw wasn't able to show them. Only after modifying my code and 'forcing' them to display (like so: function draw() {
image(imgs[0], 0, 0);
} , doing this for each picture, one by one, made me eventually display them as intended. After this procedure my original code worked as expected. Felt a bit like filling a cache. Definitely weird and maybe worth a look. |
@mberndtgen can you post a link to your sketch? i'm not quite sure i get what the different cases are. this could have to do with programmatically-generated image names, they're loaded in a different way than if they're a simple string (i.e. |
Strange, huh? :-) This code worked without problems in the alpha version of the editor. |
@mberndtgen i was playing with your sketch and i couldn't figure out what was wrong because of all of the other stuff going on in that project (which is really cool btw!). would you mind making an example that only shows the thing that appears to not be working? |
Yeah, sure! (And thanks! This is my homework for a course on Kadenze.) Here is the essence of what it takes (at least for me) to reproduce the error: It was even a bit stranger than expected: I've cloned this project from the original one (via File > Duplicate) and modified it. I've changed the png's in the images folder, too (but they still have the names of the original project: 0_image.png, 1_image.png etc.) When I run this code then imgs[0] is displayed as an image of my original project, while the same image that was loaded directly (not into an array) is displayed correctly. See here: Background: image from array, green thingy: correct image. Both were loaded as 0_image.png. This is different from my first experience when no image of the array was displayed at all, but I guess this could have the same cause. |
preload() loadImage() array is working for me .... |
@mberndtgen this is what I see: |
Oh weirdness! Now it's working on my side, too! Can't reproduce the error any longer. You better close this issue until this changes again. :-) Thanks a lot for your effort, though, I really appreciate! |
maybe it's a caching thing, or a network connection thing. i'll close this for now! |
@catarak I have no issues with preload() in safari or firefox, but on Chrome 70 on macOS (High Sierra) preloads hangs on loadImage and never loads. |
@slowizzm thanks! i'll try updating chrome and see if i can reproduce. |
thank you ... looks like you fixed it, it's working as expected now. |
i think there's sometimes an issue loading assets from S3, which comes up unpredictably. |
This issue comes up intermittently but I've never been able to pinpoint the exactly cause. Sometimes S3 will just send back a CORS issue, and then moments later it won't. Not sure! I'm going to close this but feel free to open a new issue if it comes up again. |
first link posted (https://editor.p5js.org/cassie/sketches/SJlIk0WUPX) is not working |
i am seeing loadImage() failing specifically in preload() on macOS. same sketch works on windows. sketch works on macOS if loadImage is moved into setup(). should i open a new issue or could this be reopened? |
Thanks for reporting this @eyaler! We can reopen this issue! |
preload() hangs when trying to loadImage(), never loads.
Google Chrome | 68.0.3440.106 (Official Build) (64-bit) (cohort: Stable)
Revision | 1c32c539ce0065a41cb79da7bfcd2c71af1afe62-refs/branch-heads/3440@{#794}
OS | Windows
The text was updated successfully, but these errors were encountered: