Computing.Net > Forums > Web Development > How to add an Image to a database

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

How to add an Image to a database

Reply to Message Icon

Name: rsasalm
Date: September 19, 2005 at 08:01:58 Pacific
OS: Win XP
CPU/Ram: P4
Comment:

Hi all,
I am using Mysql with PHP.
I want to add som images, *.gif *.jpe etc
How to do that?
thanks for help
regards
/rsasalm



Sponsored Link
Ads by Google

Response Number 1
Name: Tim_computer_user
Date: September 19, 2005 at 10:13:28 Pacific
Reply:

good luck. i try to learn from your questions. i will look for answers also


0

Response Number 2
Name: anonproxy
Date: September 22, 2005 at 00:07:26 Pacific
Reply:

Personally, I would avoid doing this when possible.

Let's say your picture comes from a form (could be read from a file, scraped from a webpage, etc.). Grab your uploaded temp file. Open output buffering. Use a function like createjpeg() to bring your image into local memory. Then save the output buffer to a local variable and close the buffer.

Your image is now contained in a variable. Run addslashes() on the data. Finally, insert the image into a MySQL BLOB field.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Web Development Forum Home


Sponsored links

Ads by Google


Results for: How to add an Image to a database

How to decrease the dpi in an image www.computing.net/answers/webdevel/how-to-decrease-the-dpi-in-an-image/798.html

how to stop google images from www.computing.net/answers/webdevel/how-to-stop-google-images-from/3509.html

How to make pics lighter/darker?? www.computing.net/answers/webdevel/how-to-make-pics-lighterdarker/905.html