By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,855 Members | 865 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,855 IT Pros & Developers. It's quick & easy.

Displaying Image on web page question

P: n/a
My .php app displays an image on the web page, I notice that different
..jpg images display "funny" - apparently they all have slightly
different image widths and heights yet in the image tag I have to set
those properties to something - is there a way in php to get an image
width and height so I can set it correctly for each image?

<IMG SRC="<?php echo $php_image ?>" WIDTH="268" HEIGHT="176"
BORDER="0" ALT="">

Jul 16 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Ahhhh...yes thank you.

BTW - when I write the .jpg file to my MySQL table, all I get is the
filename in the table col - I've defined the col as mediumblob to hold
the actual image but all I get is the filename - is there some kind of
trick to storing an image to a col?

Thanks...

On Mon, 25 Aug 2003 08:25:52 +1000, Matthew Vickers
<ke**@replies.in.ng> wrote:
On Sun, 24 Aug 2003 22:17:44 GMT
Ralph Freshour <ra***@primemail.com> wrote:
My .php app displays an image on the web page, I notice that different
.jpg images display "funny" - apparently they all have slightly
different image widths and heights yet in the image tag I have to set
those properties to something - is there a way in php to get an image
width and height so I can set it correctly for each image?

<IMG SRC="<?php echo $php_image ?>" WIDTH="268" HEIGHT="176"
BORDER="0" ALT="">


http://www.php.net/manual/en/function.getimagesize.php

Matt


Jul 16 '05 #2

P: n/a
But then some kind of image management scheme must be developed so
when records are deleted you don't end up with image files on the
server that don't belong to any records...???
On Mon, 25 Aug 2003 08:29:04 GMT, MeerKat
<li****************@blueyonder.co.uk> wrote:
Ralph Freshour wrote:
Ahhhh...yes thank you.

BTW - when I write the .jpg file to my MySQL table, all I get is the
filename in the table col - I've defined the col as mediumblob to hold
the actual image but all I get is the filename - is there some kind of
trick to storing an image to a col?


You've got to load in the contents of the file into a variable and save
this to the database. file_get_contents() would probably do it.

The standard response to this kind of question however, is don't store
the image in the database (the database can end up huge and clunky), but
store the filename of the image stored on the server.

MK.
Thanks...

On Mon, 25 Aug 2003 08:25:52 +1000, Matthew Vickers
<ke**@replies.in.ng> wrote:

On Sun, 24 Aug 2003 22:17:44 GMT
Ralph Freshour <ra***@primemail.com> wrote:
My .php app displays an image on the web page, I notice that different
.jpg images display "funny" - apparently they all have slightly
different image widths and heights yet in the image tag I have to set
those properties to something - is there a way in php to get an image
width and height so I can set it correctly for each image?

<IMG SRC="<?php echo $php_image ?>" WIDTH="268" HEIGHT="176"
BORDER="0" ALT="">

http://www.php.net/manual/en/function.getimagesize.php

Matt



Jul 16 '05 #3

P: n/a
Ralph Freshour wrote:
But then some kind of image management scheme must be developed so
when records are deleted you don't end up with image files on the
server that don't belong to any records...???


well, yes, you write sometyhing into your admin code (you did write an
admin interface, not just "use PHPMyAdmin", right?) to delete the files
as appropriate
Jul 16 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.