|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
I have one problem in storing a Gif file in Mysql thro' PERL... I connected Mysql thro PERL DBI. I want to read full image into a variable. i used this code open(GIF,"a.gif"); $giffile = <GIF>; close(GIF); but the problem is it reads only "one line" of GIF file .... Please help me in getting full gif image. vijay |
|
#2
|
||||
|
||||
|
vijay,
just try with a loop to read till end of the file. open(GIF,"a.gif"); while(<GIF> ){ $giffile = <GIF>; } close(GIF); just give a try... ------------------ SR - shiju.dreamcenter.net "The fear of the LORD is the beginning of knowledge..." |
|
#3
|
|||
|
|||
|
Shiju,
Shouldn't that be: $giffile .= $_; ![]() [This message has been edited by dwarf (edited June 27, 2000).] |
|
#4
|
|||
|
|||
|
What about:
open(GIF,"a.gif") or die; [1] @giffile = <GIF>; close(GIF); [1] you might want a binmode(GIF) there? Not sure. |
|
#5
|
||||
|
||||
|
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by chinnavi:
I want to read full image into a variable. i used this code open(GIF,"a.gif"); $giffile = <GIF>; close(GIF); but the problem is it reads only "one line" of GIF file .... [/quote] Try this: $path = '/path/to/a.gif'; $len = -s $path; open FH, $path or die "cannot open $path: $!n"; $bytesread = read(FH,$buffer,$len); die "read errorn" unless $bytesread == $len; close FH; now you can insert $buffer into your table... [This message has been edited by vpopper (edited June 27, 2000).] |
|
#6
|
|||
|
|||
|
Thanks for all . Now it works fine and well . Is there any way to hide the images from saving .. I saw in one site that we cant save any images by right clicking on the image .. vijay |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Perl Programming > Help in Image insertion in Mysql |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|