Displaying Image on web page question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ralph Freshour

    Displaying Image on web page question

    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="">



  • Ralph Freshour

    #2
    Re: Displaying Image on web page question

    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
    <keep@replies.i n.ng> wrote:
    [color=blue]
    >On Sun, 24 Aug 2003 22:17:44 GMT
    >Ralph Freshour <ralph@primemai l.com> wrote:
    >[color=green]
    >> 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="">[/color]
    >
    > http://www.php.net/manual/en/function.getimagesize.php
    >
    >Matt[/color]

    Comment

    • Ralph Freshour

      #3
      Re: Displaying Image on web page question

      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
      <liquidlaughter 2000@blueyonder .co.uk> wrote:
      [color=blue]
      >Ralph Freshour wrote:
      >[color=green]
      >> 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?[/color]
      >
      >You've got to load in the contents of the file into a variable and save
      >this to the database. file_get_conten ts() 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.
      >[color=green]
      >> Thanks...
      >>
      >> On Mon, 25 Aug 2003 08:25:52 +1000, Matthew Vickers
      >> <keep@replies.i n.ng> wrote:
      >>
      >>[color=darkred]
      >>>On Sun, 24 Aug 2003 22:17:44 GMT
      >>>Ralph Freshour <ralph@primemai l.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[/color]
      >>
      >>[/color][/color]

      Comment

      • matty

        #4
        Re: Displaying Image on web page question

        Ralph Freshour wrote:
        [color=blue]
        > 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...???
        >
        >[/color]

        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

        Comment

        Working...