469,343 Members | 5,711 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,343 developers. It's quick & easy.

getimagesize function and using variables to display an image

I have a dbn of images that I retrieve using SQL statements in
dreamweaver.
I want to get the file name using SQL and then place it into the
"getimagesize" function and then use this info (FileName, Width,
Height) to display the image on my web page.

something like this

<td width="620" valign="top">
<?php

//Assign 2 variables the Files name from the db and the file type

$type = 1;
$FileName = $row_TestDisplay['menu'];

list($width, $height, $type) = getimagesize($FileName);
?>
<div style="overflow: auto; width: 610px; height: 600px">
<img src="FileName" width="<?PHP $width ?>" height="<?PHP $height ?
>">
</div>
</td>

I can only get this to work using the height and width attributes in
the img tag, how can I do this.

Many thanks in advance

Voodoo Jai

Nov 11 '07 #1
1 1938
On Nov 12, 12:11 am, Voodoo Jai <voodoo...@btinternet.comwrote:
I have a dbn of images that I retrieve using SQL statements in
dreamweaver.
What's "dbn"? Never mind. You have a db.
I want to get the file name using SQL and then place it into the
"getimagesize" function and then use this info (FileName, Width,
Height) to display the image on my web page.
For terminology's sake - you don't place anything "into a function".
You call
a function with certain parameters.
something like this

<td width="620" valign="top">
<?php

//Assign 2 variables the Files name from the db and the file type

$type = 1;
$FileName = $row_TestDisplay['menu'];

list($width, $height, $type) = getimagesize($FileName);
?>
<div style="overflow: auto; width: 610px; height: 600px">
<img src="FileName" width="<?PHP $width ?>" height="<?PHP $height ?>">

</div>
</td>
Why would you need "width='$width' height='$height'" at all, if $width
and $height
are image dimensions. You only do that when you need to display it
resized. Anyway,
it's a bad (and deprecated) practice to use HTML tags to define
element's style, e.g.
image size. Use CSS rules instead.
I can only get this to work using the height and width attributes in
the img tag, how can I do this.
So, ... what's the problem? I haven't seen any questions here. "I can
get
this to work... ...how can I do this." (with a full stop at the end of
interrogative).

Are you trying to resize the image from PHP, instead of defining its
dimensions in HTML?
Please try following the general rules of punctuation and being clear
about what you want
to be helped with.
Many thanks in advance
You're welcome
>
Voodoo Jai
Regards

Nov 12 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Jonathan Lindo | last post: by
3 posts views Thread by jfsebastian | last post: by
4 posts views Thread by rcb845 | last post: by
1 post views Thread by sree | last post: by
1 post views Thread by lawrence k | last post: by
7 posts views Thread by Ja NE | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.