Jump to content


Saving images in mysql on to server?

  • Please log in to reply
2 replies to this topic

#1 d-shade

  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 15 September 2006 - 11:42 PM

Hello Ive been using a modified photo gallery script that saves images into the mysql database. I didn't have too much of an issue at first but now that database is starting to get pretty big and thought maybe I would start running into problem.

So im wondering if there is a way i can make some sort of automated script to go through all the table and dump all the images into folders and also create a new table. with all the info put into it.

these are the feilds im using in my table
Id, Views, Bytes, Format, Caption, Comment, ShotAt, PublishedAt, Width, Height, Image, Thumbnail

the biggest problem im having right now is trying to get the images saved onto the server.
the Image and Thumbnails are both blob feilds and both contain image data.

#2 michaellunsford

  • Members
  • PipPipPip
  • Advanced Member
  • 1,023 posts
  • LocationLouisiana, USA

Posted 16 September 2006 - 03:40 AM

$result=mysql_query("SELECT * FROM `table`");
while($myrow=mysql_fetch_assoc($result)) {

will save all the images to the scripts current directory. after you're satisfied that all the images have been successfully extracted, you can use phpmyadmin to drop the image field across the entire database.

#3 d-shade

  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 18 September 2006 - 06:40 PM

alright thanks.
Ill try it out

It worked out great! Finally got all the images off the mysql database.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users