How to save picture in mysql

How to save picture in mysql

Page 1 of 1

5 Replies - 34926 Views - Last Post: 19 February 2009 - 01:47 PM Rate Topic: -----

#1 mouse_catz00  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 23-January 08

How to save picture in mysql

Posted 23 January 2008 - 01:52 AM

i need help in my project. i must save picture in mysql database. :P
Is This A Good Question/Topic? 0
  • +

Replies To: How to save picture in mysql

#2 didgy58  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 246
  • Joined: 23-October 07

Re: How to save picture in mysql

Posted 23 January 2008 - 09:35 AM

do you have to save pictures or couldnt you just save the image name into mysql and then when u pull the record from the database and would like to view the picture u basically put it in a image tage


<img src="direct to the image folder/ $variable user to hold the sql return['imagename']" />



i think its something along that lines i have the code and ill grab it for u shortly and repost but its something like that off the top of my head

dan
Was This Post Helpful? 0
  • +
  • -

#3 didgy58  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 246
  • Joined: 23-October 07

Re: How to save picture in mysql

Posted 23 January 2008 - 09:41 AM


$pic=$row['Picture'];

><img src='../images/$pic' border=0 alt=''></




thats how i have gone about using images with my database

hope that helps.
Was This Post Helpful? 1

#4 MitkOK  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 32
  • View blog
  • Posts: 403
  • Joined: 09-August 07

Re: How to save picture in mysql

Posted 23 January 2008 - 11:04 PM

Alternative way, which I do not prefer :
- http://dev.mysql.com....0/en/blob.html
- http://www.weberdev....ample-3688.html

It's better to upload image in directory and put image path in MySQL field.
Was This Post Helpful? 0
  • +
  • -

#5 atomixx  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 19-February 09

Re: How to save picture in mysql

Posted 19 February 2009 - 04:18 AM

View Postmouse_catz00, on 23 Jan, 2008 - 12:52 AM, said:

i need help in my project. i must save picture in mysql database. :P

hi mouse
it is hell of a mission to get the jpg data in and out of mysql successfully.
I eventualy uploaded the pics via ftp and inserted the location relative to location of my site.
just be careful it changes between linux and windows.

use this but change the variabls acording to you display page

<img src=<?php echo $row_Recordset1['image']; ?> width="320" height="240" />


linux: sqlentry would be "dir/filename.ext" if the display page is at the root of the site
windows: sqlentry would be "dir\filename.ext" if the display page is at the root of the site

hope this helps
Was This Post Helpful? 0
  • +
  • -

#6 akozlik  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 87
  • View blog
  • Posts: 796
  • Joined: 25-February 08

Re: How to save picture in mysql

Posted 19 February 2009 - 01:47 PM

I wrote a tutorial on this exact thing:

Uploading Images with PHP
Was This Post Helpful? 1

Page 1 of 1