#1
  1. No Profile Picture
    chinnavi
    Guest
    Devshed Newbie (0 - 499 posts)
    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. #2
  3. .Net Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    London
    Posts
    987
    Rep Power
    15

    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..."
  4. #3
  5. No Profile Picture
    chinnavi
    Guest
    Devshed Newbie (0 - 499 posts)

    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
  6. #4
  7. .Net Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    London
    Posts
    987
    Rep Power
    15
    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).]
  8. #5
  9. No Profile Picture
    chinnavi
    Guest
    Devshed Newbie (0 - 499 posts)

    still the problem is

    it says "Document contained No Data"

    Is there any problem with the Code?
  10. #6
  11. .Net Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    London
    Posts
    987
    Rep Power
    15
    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..."

IMN logo majestic logo threadwatch logo seochat tools logo