|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
I have an existing table in a MySQL database and I would like to add a new field to it, into which I would like to be able to upload images using php...
I have found a few articles on the subject but being new to this I have found them a bit confusing and am looking for some 'dumbed down' assistance for the following process. 1. Upload an image from an upload page into a field in an existing database table. (with confirmation and image size limit) 2. Display that image on a web page. Thanks in advance. |
|
#2
|
|||
|
|||
|
Have you checked out the blob tutorial?
here is the link http://www.devarticles.com/art/1/68 Good luck! |
|
#3
|
|||
|
|||
|
Yep have managed to replicate that successfully but I now have my images in one table and my 'text' files in another table...rather than in the same one..
So for instance if entry one in my 'text' table requires an image from the 'blob' table I don't know how to link the two or sycronise it, so that the right image is displayed next to the right piece of text. Does that make sense.. |
|
#4
|
|||
|
|||
|
yep that makes sense,
Ive got a book called php and mysql web development with a tutorial that sounds very similar to what you are trying to achieve - i think you may even be able to view it online for free. I'll have to check it out and get back to you on that 1 cause I am buzy at the min. |
|
#5
|
|||
|
|||
|
That would be great - thanks.
|
|
#6
|
|||
|
|||
|
I'm not quite sure that loading images into a database table is quite efficient (some of a over-head). As far as I'm concerned, you should try instead to store only the path to that image.
On that subject, you should take a look at the folowing articles : http://www.zend.com/zend/trick/tricks-sept-2001.php ciao! |
|
#7
|
|||
|
|||
|
I agree with Steve on the subject. It will add to your server load, and depending on the amount and size of the images, it could slow your server down to a crawl if you have a high-traffic site. You're better off storing the path to the image in the database.
As far as your main question is concerned, you can do something like this (your column names may be different): Table: Text text_id text_desc Table: Images image_id image_path (if storing the path) text_id And in your query, it would be: SELECT text_desc, image_path FROM text, images WHERE text.text_id = images.text_id; Hope it helps! But I would definately reconsider storing the images in the database itself.
__________________
____________________________________________ Developer Shed Weekly Writer | DevArticles Forum Moderator Build Your Own KlipFolio Klip With PHP FrankManno.com - Under Construction Design Interactive Group - Under Construction |
|
#8
|
|||
|
|||
|
Thanks for your help guys.
|
|
#9
|
|||
|
|||
|
Maybe a bit too late, but can't you just merge the two tables? I mean, it's not that hard... and would allow you to poll only one table rather than two for each image/text combination. Also, steve, you never replied to my PM?
|
|
#10
|
|||
|
|||
|
Any ideas about send files to mysql and a directory?
I'm trying to make a script that allows to the user just see the file if he's logged into the application. The great cuestion is: it's possible to make that the file name gets another name different than itself, change the extension and saves into the mysql table?
By example: File to upload: johnie.jpg ==> Renamed file: GxwReeeT If anyone know how to do it i'll be thankful eternally. Mauricio Cubaque URL |
![]() |
| Viewing: Dev Articles Community Forums > Programming > General Programming Help > Binary Schminery |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|