Resizing an image

Hello!

I searched here, but only found a reference from 9 (!) years ago, so I’m hoping there’s a different answer.

Admittedly, I’m not well versed in HTML, either. Ok, that’s out of the way.

Is there a way to have an image resized automatically? We plan on having opening splash screens and it would be ideal to have the .jpg fit the current terp window. I’m using the following code I got from Nikos and Eric to display the initial image followed by the banner code:

"<div style='text-align: center;'> 
      <img src='edgesplash01.jpg' 
         style='max-width: 100%; height: auto;' 
           alt='placeholder' /> 
</div>";

cutSceneBanner.updateMe('<tab align=center><img src=\"edgesplash01.jpg\" border=0><.p>');
inputManager.getKey(nil);
cls();
cutSceneBanner.removeBanner();
cutSceneBanner.updateMe('<tab align=center><img src=\"edgesplash02.jpg\" border=0><.p>');
inputManager.getKey(nil);
cutSceneBanner.removeBanner();

So it does what I need in terms of displaying the images but I would really like to have the images resized automatically.

Is this possible?

Thanks!
– Mike

2 Likes

Does it work if you write the splash image like this?

<img width=\"100%\" src=\"edgesplash01.jpg\" border=0>

Edit: Oops. I didn’t escape the quotes.

No, it doesn’t unfortunately. I tried it a few different ways and it either displayed a thumbnail or no image at all.

I’m not very well versed in TADS, even though I’ve messed with it in the past, so I can’t really help you much here. Hopefully someone else can jump in.

Although, I wonder if you actually need to escape the quotes there. Since you’re surrounding the text in single quotes, double quotes without the escape character should be acceptable, I would think.

Thanks for trying, tayruh. I think TADS does have limitations but I’m hoping this can be done.

You’re right about the quotes; it’s not necessary.

– Mike

In non-webUI games, you can only specify a size in pixels. Relative sizes are unfortunately not supported. Also, style sheets aren’t supported. So things like style='text-align: center;' don’t actually do anything.

1 Like

Thanks for confirming!

If not much trouble, can you point me in the right direction on how to specify size in pixels?

Thanks,
– Mike

So yeah, it was easier than I thought. I was afraid my lack of HTML skills would be a detriment, but it’s simply done by adding height =“nn” width =“nn”.

– Mike

1 Like

You only need to specify width or height. Specifying just one will set the other one automatically to a value that keeps the image’s aspect ratio.

1 Like

Perfect – thanks again!