3

I'm creating a site in PHP and MySQL that when an image is emailed to us at adress@example.com from someone's phone, I want the image to be automatically posted to their account page that is tied to the email address that they registered with us.

Also, I would like the subject of the email to determine what category the email falls under. So lets say the email had the subject of 3. Then it would give it the category ID of 3.

So lets say we have a users table with

user_id
email_address
name

and an image table with the following fields

image_id
category_id
user_id
image_name

The category table will be category_id category_name

Is there something I need to be doing with our mail server? Also should I be storing the image in the database or as a file?

This site will not get a lot of traffic and will only be used for one weekend. I'm guessing no more than 5000 images but I could be wrong.

bigmike7801
  • 3,908
  • 9
  • 49
  • 77

1 Answers1

1

Look at procmail for passing emails into scripts. Images should definitely be stored as files. You'll have to parse the email you receive and base64_decode the appropriate chunk to get the image data.

Michael Mior
  • 28,107
  • 9
  • 89
  • 113
  • And that reason is not storing images (IMO). It means any time you want to display an image, you need to get it from the database. It's still passing through your web server anyway. Why put extra load on the database server for no reason? – Michael Mior Jun 29 '11 at 22:47
  • 1
    @Eric J: You then have the overhead of converting the data from the blob in order to use it in anything, and the overhead of the extra storage which affects many other things you do with your database (including backup size and time). I'm not giving this answer a +1 because I don't think it really answers the question asked well enough, but I think that @Michael is right about storing images as files. – Ken White Jun 29 '11 at 22:57
  • @Ken I agree that a more detailed answer is warranted. Unfortunately, still at the office for the time being, just a little SO break. – Michael Mior Jun 29 '11 at 23:15