Check if image exists (also after deployment) [Solved]

Status
Not open for further replies.

SilverDash

Veteran
Veteran
Joined
Oct 11, 2015
Messages
423
Reaction score
170
First Language
Dutch
Primarily Uses
RMMV
JavaScript:
pictureExists = function(filename) { // filename must include file extension.
    const fs = require ("fs");
    return fs.existsSync("./img/pictures" + filename);
};
See also here.

The code above works in the editor but after deploying my project, it always returns false. How do I make this work for both cases (on all platforms)?
 
Last edited:

ShadowDragon

Veteran
Veteran
Joined
Oct 8, 2018
Messages
1,693
Reaction score
554
First Language
Dutch
Primarily Uses
RMMV
maybe an "if statement"

if {!filename}
throw new error
else return true ?

that might be the most logic idea though, but idk the most efficient way.
 

SilverDash

Veteran
Veteran
Joined
Oct 11, 2015
Messages
423
Reaction score
170
First Language
Dutch
Primarily Uses
RMMV
Filename checking is not required because the ImageManager does this internally.
I need to check if the image exists on disk.
 

ozubon

surströmming?
Veteran
Joined
Oct 16, 2018
Messages
178
Reaction score
164
First Language
English
Primarily Uses
RMMV
When deployed, the pictures folder is no longer one branch from the launcher but at /www/img/pictures/. You might wanna look at what I posted here, it works both in the editor and when deployed:
You can use the plugin or if you want copy the bit you need :')
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
12,954
Reaction score
13,310
First Language
English
Primarily Uses
RMVXA

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

So, the other day i come across to became closer to other developers and realiza im not even a novice. i am lower than thrash rigth now, worse than people that don´t know anything about this things cause i used to think i knew. good news is; today thrash, tommorrow, maybe not so much, and someday, i´ll be a god?
Ahh, end of the day stinky feet, fresh out of the boots. Smells like a job well done. Seriously, I have to rinse my feet when I get home, or it's not fair to my wife.
Stream will be live shortly with some pixel art! Feel free to drop by!

Can't believe I forgot to put an image of my drawing pad! It looks kinda like this, maybe I'll get a better pic tomorrow...
Backup tip: If you don't want to back up your whole project every day, at least back up everything *except* your Image and Audio folders, which you can do weekly/as needed/etc.

Forum statistics

Threads
97,829
Messages
947,201
Members
129,040
Latest member
nhandinhbongdaseriea
Top