Jump to content

Help me adding and fetching images from mysql database

I am so not able to know how am i supposed to fetch or insert images into database so if anyone could help would be great

 

Evil's Advocate Approved.

Link to comment
Share on other sites

Link to post
Share on other sites

you don't

storing the path is often a better idea

 

if you MUST store them in the database, i presume you would have to save them in a blob field, but again, it wouldn't be optimal

Link to comment
Share on other sites

Link to post
Share on other sites

What language are you using?

There are upsides and downsides to this approach, you'll find

plenty of pro and con arguments when you google around. As @Ciccioo

says, often you can just store the image path, and if you really

do wish to store the images directly in the database, you'd use

a blob field. I have done this for a website I did, it's not really

that difficult (although I'd need to look it up again as I haven't

looked at it in a while ;)).

BUILD LOGS: HELIOS - Latest Update: 2015-SEP-06 ::: ZEUS - BOTW 2013-JUN-28 ::: APOLLO - Complete: 2014-MAY-10
OTHER STUFF: Cable Lacing Tutorial ::: What Is ZFS? ::: mincss Primer ::: LSI RAID Card Flashing Tutorial
FORUM INFO: Community Standards ::: The Moderating Team ::: 10TB+ Storage Showoff Topic

Link to comment
Share on other sites

Link to post
Share on other sites

Basically: all of the above...

 

Storing images in the database is usually slower and more

resource consuming than only storing the image path.

 

Since you didn't specify what language you're working with,

I can't really help with any specific code. Maybe elaborate

a bit more on what it is you're trying to accomplish?

Link to comment
Share on other sites

Link to post
Share on other sites

Blob data type. Some say to just store a file path. The issue there is synchronization between disc and database.

Link to comment
Share on other sites

Link to post
Share on other sites

I am so not able to know how am i supposed to fetch or insert images into database so if anyone could help would be great

 

...

 

....

 

and again the OP is not subscribed to his own thread ...

Mini-Desktop: NCASE M1 Build Log
Mini-Server: M350 Build Log

Link to comment
Share on other sites

Link to post
Share on other sites

i use php basically but i have only learnt php for content management system not more

Evil's Advocate Approved.

Link to comment
Share on other sites

Link to post
Share on other sites

i use php basically but i have only learnt php for content management system not more

I take it you're used to writing Drupal or Joomla modules and now want to build a website from scratch?

 

It'll seem a bit basic, but it's never a bad idea to start at w3schools.

Link to comment
Share on other sites

Link to post
Share on other sites

yeah ok i'll try thank you

Evil's Advocate Approved.

Link to comment
Share on other sites

Link to post
Share on other sites

I would not store them in the database.  Only store the path to the image in the database.  You can then use that path to get the image where you need it.

Desktop: Intel Core i7-6700K, ASUS Z170-A, ASUS STRIX GTX 1080 Ti, 16GB DDR4 RAM, 512 GB Samsund 840 Pro, Seasonic X series 650W PSU, Fractal Design Define R4, 2x5TB HDD

Hypervisor 1: Intel Xeon E5-2630L, ASRock EPC612D8, 16GB DDR4 ECC RAM, Intel RT3WB080 8-port RAID controller plus expansion card, Norco RPC-4020 case, 20x2TB WD Red HDD

Other spare hypervisors: Dell Poweredge 2950, HP Proliant DL380 G5

Laptops: ThinkPads, lots of ThinkPads

 

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×