Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
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  
Old May 28th, 2000, 02:41 AM
chinnavi
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
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?


Reply With Quote
  #2  
Old May 29th, 2000, 02:01 AM
Shiju Rajan's Avatar
Shiju Rajan Shiju Rajan is offline
.Net Developer
Dev Shed Novice (500 - 999 posts)
 
Join Date: Feb 2000
Location: London
Posts: 987 Shiju Rajan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 26 m 22 sec
Reputation Power: 9
Send a message via MSN to Shiju Rajan Send a message via Yahoo to Shiju Rajan

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

Reply With Quote
  #3  
Old May 30th, 2000, 11:28 AM
chinnavi
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:

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

Reply With Quote
  #4  
Old May 31st, 2000, 03:29 AM
Shiju Rajan's Avatar
Shiju Rajan Shiju Rajan is offline
.Net Developer
Dev Shed Novice (500 - 999 posts)
 
Join Date: Feb 2000
Location: London
Posts: 987 Shiju Rajan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 26 m 22 sec
Reputation Power: 9
Send a message via MSN to Shiju Rajan Send a message via Yahoo to Shiju Rajan
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).]

Reply With Quote
  #5  
Old June 2nd, 2000, 07:54 AM
chinnavi
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:

still the problem is

it says "Document contained No Data"

Is there any problem with the Code?

Reply With Quote
  #6  
Old June 2nd, 2000, 09:02 AM
Shiju Rajan's Avatar
Shiju Rajan Shiju Rajan is offline
.Net Developer
Dev Shed Novice (500 - 999 posts)
 
Join Date: Feb 2000
Location: London
Posts: 987 Shiju Rajan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 26 m 22 sec
Reputation Power: 9
Send a message via MSN to Shiju Rajan Send a message via Yahoo to Shiju Rajan
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..."

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > How i can pass gif/jpg to applet!


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway