Login
Remember
IF Answers
Ask a Question

# How do you center images in Quest?

0 votes
31 views
asked Oct 14 in Authoring by Mareus

I was wondering if anyone knows the code to center images in quest? The way it is currently set up, the immage is automatically set to the left side of the screen. So if you are using small pictures, it looks kind of weird. Is there a simple code to center an image?

Thanks in advance!

- quest
- programming
- editor
- images

## 1 Answer

0 votes
answered Oct 15 by The Pixie (121 points)

Try this:

    msg ("<img src=\"" + GetFileURL("gravestone.png") + "\" style=\"display: block; margin-left: auto; margin-right: auto;\" />")

commented Oct 15 by Mareus (1 point)
Well, when i copy your code I get a broken image in the center. I guess, my next question is how do you put a picture there? Perhaps instead of GetFileURL there is a code to show the picture directly from my hard disk? Thanks in advance for your response.
commented Oct 18 by The Pixie (121 points)
Are you editing online?
If not make sure the image file is in the same folder as your game file.
If you are online, it seems the code editor objects to HTML codes, so it will be a bit more effort. First use the picture command to upload your image. Then add a message command, set it to show an expression, and paste in this:
"<img src=\"" + GetFileURL("gravestone.png") + "\" style=\"display: block; margin-left: auto; margin-right: auto;\" />"
Check it works, you show see the image twice, then you can delete the picture command.
More on displaying images here, but again it assumes you are offline:
http://forum.textadventures.co.uk/viewtopic.php?f=18&t=5566

## Related questions

- How do I use the create exit command properly in Quest
- How do I debug in Quest?
- How do I find the default parser verbs in Quest?
- How can I make use of the health variable in Quest through the editor
- How do you make choices in Quest?

...