Professional Web Applications Themes

publish JPEG or HTML from a database - PHP Development

I have a jpeg file and a HTML page that are stored in two separate blob fields of a databses, namely interbase, what is the best method of pulling each of these items out so that they can be displayed in a web browser....

  1. #1

    Default publish JPEG or HTML from a database

    I have a jpeg file and a HTML page that are stored in two separate
    blob fields of a databses, namely interbase, what is the best method
    of pulling each of these items out so that they can be displayed in a
    web browser.
    UnixUser Guest

  2. #2

    Default Re: publish JPEG or HTML from a database

    UnixUser wrote:
    > I have a jpeg file and a HTML page that are stored in two separate
    > blob fields of a databses, namely interbase, what is the best method
    > of pulling each of these items out so that they can be displayed in a
    > web browser.
    The method that has worked for me for dispalying images is:

    show_image.php
    --------------
    <?php
    header('Content-type: image/jpeg');
    $query='SELECT field_name FROM table_name WHERE id = '.$_GET['id'];
    // add your database code to perform query and store
    // data in $data variable
    echo $data;
    ?>

    Then in the HTML, I use:
    <img src="show_image.php?id=24" alt="">

    You can do the same with HTML, but your Content-type should be
    'text/html' instead.

    --
    Justin Koivisto - [email]spamkoivi.com[/email]
    PHP POSTERS: Please use comp.lang.php for PHP related questions,
    alt.php* groups are not recommended.

    Justin Koivisto Guest

  3. #3

    Default Re: publish JPEG or HTML from a database

    Image files are commonly displayed from a MySQL database by linking to
    another php page . . .

    <image src ="display_image.php?imageid=<?php echo $yourimageid; ?>";

    Your display image page (display_image.php in this case)

    <?
    require("config.inc");
    $sql = "SELECT src FROM images WHERE id=\"$id\"";
    $result = mysql_query($sql,$connection) or die("Couldn't execute get sector
    types query");
    while ($row = mysql_fetch_array($result)) {
    $src = $row['src'];
    }
    echo $src;
    ?>

    I'm not sure about the HTML in a BLOB field but I assume it would be roughly
    the same . . .

    -Jamie



    On 11/14/03 1:34 PM, in article
    [email]a1c0482e.0311141034.65f6f6a2posting.google.com[/email], "UnixUser"
    <rafel.coylepfshouston.com> wrote:
    > I have a jpeg file and a HTML page that are stored in two separate
    > blob fields of a databses, namely interbase, what is the best method
    > of pulling each of these items out so that they can be displayed in a
    > web browser.


    -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
    [url]http://www.newsfeeds.com[/url] - The #1 Newsgroup Service in the World!
    -----== Over 100,000 Newsgroups - 19 Different Servers! =-----
    Jamie Davison Guest

  4. #4

    Default Re: publish JPEG or HTML from a database

    Jamie Davison wrote:
    > <img src="display_image.php?imageid=<?php echo $yourimageid; ?>";
    >
    > Your display image page (display_image.php in this case)
    >
    > <?
    > require("config.inc");
    > $sql = "SELECT src FROM images WHERE id=\"$id\"";
    > $result = mysql_query($sql,$connection) or die("Couldn't execute get sector
    > types query");
    > while ($row = mysql_fetch_array($result)) {
    > $src = $row['src'];
    > }
    > echo $src;
    > ?>
    This would display garbage on the screen... You need to send header
    information for the Content-type (see my previous post).

    --
    Justin Koivisto - [email]spamkoivi.com[/email]
    PHP POSTERS: Please use comp.lang.php for PHP related questions,
    alt.php* groups are not recommended.

    Justin Koivisto Guest

  5. #5

    Default Re: publish JPEG or HTML from a database

    I might have been a bit unclear. You must link "to" the display_image.php
    page from the calling php page with
    <img src="display_image.php?imageid=<?php echo $yourimageid; ?>">

    I have used this same format with greatb success . . .

    JD

    On 11/14/03 2:18 PM, in article pU9tb.912$Uz.26563news7.onvoy.net, "Justin
    Koivisto" <spamkoivi.com> wrote:
    > Jamie Davison wrote:
    >> <img src="display_image.php?imageid=<?php echo $yourimageid; ?>">
    >>
    >> Your display image page (display_image.php in this case)
    >>
    >> <?
    >> require("config.inc");
    >> $sql = "SELECT src FROM images WHERE id=\"$id\"";
    >> $result = mysql_query($sql,$connection) or die("Couldn't execute get sector
    >> types query");
    >> while ($row = mysql_fetch_array($result)) {
    >> $src = $row['src'];
    >> }
    >> echo $src;
    >> ?>
    >
    > This would display garbage on the screen... You need to send header
    > information for the Content-type (see my previous post).


    -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
    [url]http://www.newsfeeds.com[/url] - The #1 Newsgroup Service in the World!
    -----== Over 100,000 Newsgroups - 19 Different Servers! =-----
    Jamie Davison Guest

  6. #6

    Default Re: publish JPEG or HTML from a database

    Jamie Davison wrote:
    > On 11/14/03 2:18 PM, in article pU9tb.912$Uz.26563news7.onvoy.net, "Justin
    > Koivisto" <spamkoivi.com> wrote:
    >
    >
    >>Jamie Davison wrote:
    >>
    >>><img src="display_image.php?imageid=<?php echo $yourimageid; ?>">
    >>>
    >>>Your display image page (display_image.php in this case)
    >>>
    >>><?
    >>>require("config.inc");
    >>>$sql = "SELECT src FROM images WHERE id=\"$id\"";
    >>>$result = mysql_query($sql,$connection) or die("Couldn't execute get sector
    >>>types query");
    >>>while ($row = mysql_fetch_array($result)) {
    >>> $src = $row['src'];
    >>>}
    >>>echo $src;
    >>>?>
    >>
    >>This would display garbage on the screen... You need to send header
    >>information for the Content-type (see my previous post).
    >
    **Fixed top-posting **
    > I might have been a bit unclear. You must link "to" the display_image.php
    > page from the calling php page with
    > <img src="display_image.php?imageid=<?php echo $yourimageid; ?>">
    >
    > I have used this same format with greatb success . . .
    See my post that came in just before yours....

    In any case, you still need to send the content-type headers for the
    browsers to display the image properly, or you will get a blank image.
    Maybe *some* browsers will automatically figure it out, but when I first
    did this, if the header wasn't sent, the image didn't display.

    --
    Justin Koivisto - [email]spamkoivi.com[/email]
    PHP POSTERS: Please use comp.lang.php for PHP related questions,
    alt.php* groups are not recommended.

    Justin Koivisto Guest

  7. #7

    Default Re: publish JPEG or HTML from a database

    Where you you include this "content-type" header? I have used the very
    method below many times and never had to sent a content header simply
    because PHP and HTML expect an image from the <img src> tag.

    -JD




    On 11/14/03 3:41 PM, in article j6btb.915$Uz.26871news7.onvoy.net, "Justin
    Koivisto" <spamkoivi.com> wrote:
    > Jamie Davison wrote:
    >
    >> On 11/14/03 2:18 PM, in article pU9tb.912$Uz.26563news7.onvoy.net, "Justin
    >> Koivisto" <spamkoivi.com> wrote:
    >>
    >>
    >>> Jamie Davison wrote:
    >>>
    >>>> <img src="display_image.php?imageid=<?php echo $yourimageid; ?>">
    >>>>
    >>>> Your display image page (display_image.php in this case)
    >>>>
    >>>> <?
    >>>> require("config.inc");
    >>>> $sql = "SELECT src FROM images WHERE id=\"$id\"";
    >>>> $result = mysql_query($sql,$connection) or die("Couldn't execute get sector
    >>>> types query");
    >>>> while ($row = mysql_fetch_array($result)) {
    >>>> $src = $row['src'];
    >>>> }
    >>>> echo $src;
    >>>> ?>
    >>>
    >>> This would display garbage on the screen... You need to send header
    >>> information for the Content-type (see my previous post).
    >>
    >
    > **Fixed top-posting **
    >
    >> I might have been a bit unclear. You must link "to" the display_image.php
    >> page from the calling php page with
    >> <img src="display_image.php?imageid=<?php echo $yourimageid; ?>">
    >>
    >> I have used this same format with greatb success . . .
    >
    > See my post that came in just before yours....
    >
    > In any case, you still need to send the content-type headers for the
    > browsers to display the image properly, or you will get a blank image.
    > Maybe *some* browsers will automatically figure it out, but when I first
    > did this, if the header wasn't sent, the image didn't display.


    -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
    [url]http://www.newsfeeds.com[/url] - The #1 Newsgroup Service in the World!
    -----== Over 100,000 Newsgroups - 19 Different Servers! =-----
    Jamie Davison Guest

  8. #8

    Default Re: publish JPEG or HTML from a database

    Jamie Davison wrote:
    > Where you you include this "content-type" header? I have used the very
    > method below many times and never had to sent a content header simply
    > because PHP and HTML expect an image from the <img src> tag.
    Check my reply to the OP

    --
    Justin Koivisto - [email]spamkoivi.com[/email]
    PHP POSTERS: Please use comp.lang.php for PHP related questions,
    alt.php* groups are not recommended.

    Justin Koivisto Guest

Similar Threads

  1. Replies: 2
    Last Post: December 23rd, 08:15 PM
  2. PHP Interbase or Firebird database JPEG output
    By UnixUser in forum PHP Development
    Replies: 0
    Last Post: November 17th, 03:50 AM
  3. Publish to HTML
    By Charine webforumsuser@macromedia.com in forum Macromedia Freehand
    Replies: 0
    Last Post: November 7th, 01:57 AM
  4. Publish Settings HTML
    By arjaylee webforumsuser@macromedia.com in forum Macromedia Flash Sitedesign
    Replies: 2
    Last Post: September 19th, 05:51 AM
  5. Resizing a jpeg stored in a database
    By Donald Tyler in forum PHP Development
    Replies: 0
    Last Post: September 18th, 08:51 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139