473,396 Members | 1,987 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 2238
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Jonathan Lindo | last post by:
Hey All, Running Redhat9, Apache 2.0.40, PHP 4.3.4. GD support is enabled. GetImageSize() returns FALSE on almost all JPGs, but does return with the correct info on *some* JPGs. The array...
3
by: jfsebastian | last post by:
Hi, I am wondering if getImageSize does fetch images *before* extracting the size infos (like perl modules...) or if the function only fetch the few bytes in the file headers which contains...
4
by: rcb845 | last post by:
Hi everybody of the PHP community, I am using the php function "getimagesize()" to access the width/height of an image from the Web. This function should return false if image is not available....
1
by: sree | last post by:
Hi, am new bie to this group. I requesting help from you all. Am geeting warnig with getimagesize() function. I will explain my query by first giving my code. $src = $_GET; $imageInfo =...
1
by: lawrence k | last post by:
I've got an intermittent bug that is very hard to trace. On my site, if I log into a new account and try to upload some images, something goes wrong the first time. Everything works fine after the...
2
by: bizt | last post by:
Hi, Is it possible to obtain the width/ height of an image when that image is dyanically created using a PHP script and passing GET attributes. For example: <img...
7
by: stephcsh | last post by:
Hi, My application is working fine on server A, which is using PHP 4.4.1. However, after it is copied over to server B, which is using PHP 4.4.6, I got several problems related to pdf and xml. ...
7
by: Ja NE | last post by:
(as first - thank you for all your help several years ago, and second - please apologise me for my clumsy enlgish) so, preface: some users on my photo related site sometimes enter (link) giant...
0
by: RobUK | last post by:
We have Apache on the local network managing several websites that are accessed using virtual domains (configured in the local machine's hosts file, eg. 192.168.1.10 points to dev.somedomain.com). ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.