Forum Moderators: open
Just a quick question about the possibility to move images from the database to the file-system on the server....I have a MySql database which is just over 5 GB in size. People who designed it, stored things such as pdf files and images in the database, as blob, instead of file system (I know that there is a huge discussion on which is better and I'm not going in that direction)
Now, I was wondering if there is a way to move all the files that are in blob to the filesystem on the server? I mean, is there a script or something that could automatically do the process or does it have to be done manually? Any help would be appreciated...
p.s. I'm on dedicated server if it makes any difference....
my $pathToImages = '/path/to/my/images/';
# Loop through your query result set and get the $imageName and $imageBlob
my $imageName = $pathToImages . 'myImageName.jpg';
open (FH1, ">$imageName");
flock (FH1, 2);
print FH1 "$imageBlob";
close (FH1);
# get next record in result set and process