![]() |
|
Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re: Images into MySQL databaseby blokhead (Monsignor) |
on Jan 23, 2003 at 01:33 UTC ( #229192=note: print w/replies, xml ) | Need Help?? |
Considering you are getting some data into the blob column, you are on the right track. Your problem is most likely here:
Unless you have changed $/ from its default in some unshown code, this line will only read the first line of the file (i.e., until the first \n character). The data in the database is probably the correct bytes, but only the first fraction of them. To avoid that, "slurp" the entire file in one go: If that doesn't work, or you're sure that the data in the db is the correct byte length, you may be facing a problem with the software. I've never used the programs you've mentioned, so I can't say. The rest of the code looks good. While some might cringe at your use of $img for a filehandle and then a scalar, I don't mind -- I do it too. ;) blokhead
In Section
Seekers of Perl Wisdom
|
|