|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
i want to pass a gif file to applet.i know
it is very easy . unfortunately my gif file is in MySQL . How can i pass this into applet? |
|
#2
|
||||
|
||||
|
i think, first you should read the image from the databse to a .pl.print image header to that page(ie, print "Content-type: image/gifnn" ,then simply pass that image.pl to the applet. <applet code=img.class width=250 height=250> <param name=image value="cgi-bin/image.pl"> </applet> Good Luck!!! ------------------ SR - shiju.dreamcenter.net "The fear of the LORD is the beginning of knowledge..." |
|
#3
|
|||
|
|||
|
i tried .....but the problem is the code is --------------- #!/usr/bin/perl use CGI; use DBI; $database="brilines"; $table="GIFS"; $user="root"; $password=""; $dsn="DBI:mysql:$database"; $dbh=DBI->connect($dsn, $user, $password); $sth=$dbh->prepare("select * from $table where id=1"); $sth->execute(); $ref=$sth->fetchrow_hashref(); #print "content-type: text/htmlnn"; #print "<html><body>"; #print "<hr>"; print "content-type: image/gifnn"; print $ref->{'picture1'}; $numRows=$sth->rows; print "<br>$numRows"; $sth->finish(); $dbh->disconnect(); ---------- mysql> select * from GIFS; +------+----------+ | id | picture1 | +------+----------+ | 12 | | | 1 | | +------+----------+ 2 rows in set (0.02 sec) But i couldnt able to get that gif file by calling http://192.168.0.10/cgi-bin/rgif.pl Why it is so vijay |
|
#4
|
||||
|
||||
|
I think the header information is not passing properly.also remove all the html tags from it (including <br> ).
<< print "content-type: image/gifnn"; print $ref->{'picture1'}; $numRows=$sth->rows; print "<br>$numRows"; >> Just print like this: print "Content-type: image/gifnn"; print $ref->{'picture1'}; You should just try this with html header also for seeing wether the picture is fetching correctly. ------------------ SR - shiju.dreamcenter.net "The fear of the LORD is the beginning of knowledge..." [This message has been edited by Shiju Rajan (edited May 31, 2000).] |
|
#5
|
|||
|
|||
|
still the problem is it says "Document contained No Data" Is there any problem with the Code? |
|
#6
|
||||
|
||||
|
I think data is not fetching properly.
##########-Try the following -######## #!/usr/bin/perl use DBI; print "Content-type : text/htmlnn"; #print "Content-type : image/gifnn"; $dbh=DBI->connect('dbi:mysql:database','usr','pwd'); $sql="select * from $table where id=1"; #print "Database Connected<br>n"; $sth = $dbh->prepare($sql); $rv = $sth->execute; @row = $sth->fetchrow_array; print $row[1]; #picture1 field #if ($rv==0){ #print "No Recordsn"; #}else{ #while(@row = $sth->fetchrow_array) { #print "Picture :".$row[1]."<br>n"; #} } if it is working properly.then remove html header and use image header. Good Luck!! ------------------ SR - shiju.dreamcenter.net "The fear of the LORD is the beginning of knowledge..." |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Perl Programming > How i can pass gif/jpg to applet! |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|