[olug] PHP vs. Perl
Jonathan Warren
thechunk at cox.net
Wed Nov 27 17:27:29 UTC 2002
This is all I can find along those lines. It bassically has an image pointer to another dynamic page that is of type image/gif with the data from the database. So I think if you want to do a photo you will need an dynamic page that can appear to be an image. I checked w3.org and it isn't possible to just include image data in the html you have to point to a uri. At least I havent' found the tag yet that would let you do that. Now the uri can retrieve the image but that is all it can be is a valid image stream.
FILE: SHOWIMG.ASP
<%@ LANGUAGE="VBSCRIPT" %>
<%
' Clear out the existing HTTP header information
Response.Expires = 0
Response.Buffer = TRUE
Response.Clear
' Change the HTTP header to reflect that an image is being passed.
Response.ContentType = "image/gif"
Set cn = Server.CreateObject("ADODB.Connection")
' The following open line assumes you have set up a System DataSource
' by the name of myDSN.
cn.Open "DSN=myDSN;UID=sa;PWD=;DATABASE=pubs"
Set rs = cn.Execute("SELECT logo FROM pub_info WHERE pub_id='0736'")
Response.BinaryWrite rs("logo")
Response.End
%>
This script only displays an image on the screen. If you wish to display an image from an HTML or ASP document you must refer to this script in an image tag. For example, if you wished to display this image with a caption describing it, you might use the following HTML page:
<HTML>
<HEAD><TITLE>Display Image</TITLE></HEAD>
<BODY>
This page will display the image New Moon Books from a SQL Server
image field.<BR>
<IMG SRC="SHOWIMG.ASP">
</BODY>
</HTML>
On Wed, Nov 27, 2002 at 10:58:12AM -0600, Andrew Holm-Hansen wrote:
>
> It looks like PHP is able to do just that...
> [1]http://www.onlamp.com/pub/a/onlamp/2002/05/09/webdb2.html
> Basically, set the mime header, stream the data.
> Andrew
> Andrew Holm-Hansen wrote:
>
> I think in Java, you can just retrieve them as blobs or longs,
> typecast them, and embed them. I don't know about PHP, but it would
> surely have the same functionality.
> Andrew
> Jonathan Warren wrote:
>
> Normally a photo linked into a page is a pointer back to the image. It seems t
> o me if you want a photo to be served up from a db your going to have to some h
> ow alias the db pointer in your web server to a url. I don't know of anythign
> to do this. I don't know if you can embed the image than the browser should be
> able to interpret it. Basically I am suggesting you dump all your images in a
> scripted manner and write php to interpret your pictures directory. If you fi
> nd a way to use images direct from a db please share with the list. I would li
> ke to know how it is done.
>
> -Jon W
>
>
> On Wed, Nov 27, 2002 at 09:18:25AM -0600, Joe Catanzaro wrote:
>
>
> I'm in the process of building a web page for my family (we just had a
> baby, blah, blah, blah), and I have several questions.
>
> 1. Most of my web page data, such as photos are stored in a MySQL database.
> To manage the database I use MySQLMan by Gossamer-Threads
> [2]http://www.gossamer-threads.com/scripts/mysqlman/ , and it's a great web
> interface to manage the database, but when it lists the photos on the web
> page, it displays them as they are stored, rather than as they should
> appear (funky garbage characters). Can someone recommend a web interface to
> manage a MySQL database? I've heard of PHPmyadmin. Any good? If so, does it
> display photo images rather than a bunch of garbage characters all over the
> screen?
>
> 2. To extract these photos and other data (text and video) from the
> database, I normally use Perl's DBI. Is there any advantage in learning PHP
> to create these web pages? The reason I'm asking this question here is
> because of the survey I saw posted on OLUG that most people prefer PHP over
> Perl to create web pages.
> [3]http://www.olug.org/modules.php?name=Surveys&op=results&pollID=10&mode=&orde
> r=&thold=
>
> 3. I'm using a MySQL database in hopes all of this is going to scale no
> matter how many photos I've got in that database. Are there any
> disadvantages to building my site in this manner or have I assumed
> correctly that this is a best practice?
>
> Thanks in advance and have a very Happy Thanksgiving,
>
>
>
>
> Joe Catanzaro
> [4]joecatanzaro at cox.net
>
> _______________________________________________
> OLUG mailing list
> [5]OLUG at olug.org
> [6]http://lists.olug.org/mailman/listinfo/olug
>
>
> _______________________________________________
> OLUG mailing list
> [7]OLUG at olug.org
> [8]http://lists.olug.org/mailman/listinfo/olug
>
> References
>
> 1. http://www.onlamp.com/pub/a/onlamp/2002/05/09/webdb2.html
> 2. http://www.gossamer-threads.com/scripts/mysqlman/
> 3. http://www.olug.org/modules.php?name=Surveys&op=results&pollID=10&mode=&order=&thold=
> 4. mailto:joecatanzaro at cox.net
> 5. mailto:OLUG at olug.org
> 6. http://lists.olug.org/mailman/listinfo/olug
> 7. mailto:OLUG at olug.org
> 8. http://lists.olug.org/mailman/listinfo/olug
More information about the OLUG
mailing list