How to set the size of an image


#1

I have the following code on my Web page:
[php]

<?php $availabilityFile = "https://ws.admin.washington.edu/decisionsupport/v1/dataavailability"; // "https://ucs.admin.washington.edu/DecisionSupport/DataAvailability.aspx"; readfile( $availabilityFile ); ?>

[/php]

I want to be able to set the size of the image so it doesn’t fill the entire page. What code would I add to this to do that? Thank you.


#2

Well, that’s not an image, its a folder. you could use the gd library, or just hardcode it using an img width and/or height attribute.


#3

anothr option is to use a dynamic resizing script such as timThumb http://code.google.com/p/timthumb/

to resize an image you place the php file on your server then point to the file pass it the image path and desired dimension inside an img tag like:

<img src="timthumb.php?src=image.jpg&w=180">

Look at the demos http://www.binarymoon.co.uk/demo/timthumb-basic/


#4

Another alternative would be to use a table. Simple… Just create a table with width=“100%” and it will fill the page across fully. And, put everything inside the table. Just create a table with one row and one TD and put all your page code inside that. I have done it and it works well.


#5

Though that would work using tables for layout is bad practice it’s best to use Symantec markup instead such as divs withs CSS applied for styling tables are best used for tabular data


#6

Yes, if it is truly an image, you could just use PHP’s image functions to resize it to the width of the current screen or to a set size like 800x600. Or, just use a “width=100%” for the tag. Tons of ways to do this depending on what the actual application is.

If you really want us to help you with this, you must explain a little further and show some sample code with an image in it.