How to open a file in ruby?
I am trying to display an image in a ruby program. I have thought of a way to do this but it may be a completely crazy idea that wont work. what i am thinking is having a html file in the same folder as the ruby code. so on the last line of code it accesses that file and basically redirects the person to the web page with the image that i want them to see. if anyone knows how to do this or knows another method of displaying the image that would be great. i am working on a mac
Observing members:
0
Composing members:
0
11 Answers
Is this anything you had in mind? You just need the direct URL of the image.
If that’s not what you mean, could you maybe try to be a tad more specific? Or clear. I’m not sure I understand completely. Sorry! Hope that does help though. :P
well i suppose that would work if it displays the image for the person running the code. it is an interactive game and i want the image to be like the endscene of the game
i dont think this works to display the image, does anyone know of a way to do this?
Hmmm…. I’ll keep thinkin’ and lookin’ as well. I’ve never needed to do that, so If I figure it out, or see it somewhere, I’ll come back and post. :)
Is this what you had in mind? It has 5 pages total, so be sure to read through all of them. It actually is related to your intentions, because it is about loading images in games. So, I think this could be what you are looking for.
If it is, lemme know! If not? Well, I’ll just keep looking!
It looks like that code should work, but I cant get it to. i think i dont have ruby game or something installed and i need to know how to set this thing up
This is a great guide showing how to install it a few different ways.
This is another. I prefer the first link, because It seems to have more methods. And, if one way doesn’t work, there are other ways to try!
Lemme know if any of these helped!
that could work. the only problem is i have to send the code to a professor to turn it in. is there a way to have everything in a folder and when they run my code it would install rubygame. the problem is that i dont know if he will be running it on a mac
Hmm… I’m actually unsure about that. Sadly I’ve never really taken any of my files and moved them any where else. I’m sure there is, because that would be somewhat stupid to not be able to do… I’m sure there are a few forums for this sort of thing. I can point you to this site, and this. Hopefully you can find someone there who seems to know a little more than me.
Sorry!
thanks man ill look there
Answer this question
This question is in the General Section. Responses must be helpful and on-topic.