General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old December 5th, 2002, 11:24 AM
steve55 steve55 is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Location: UK
Posts: 44 steve55 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via AIM to steve55 Send a message via Yahoo to steve55
Exclamation Binary Schminery

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.

Reply With Quote
  #2  
Old December 5th, 2002, 01:05 PM
Gee Gee is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Posts: 61 Gee User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Have you checked out the blob tutorial?

here is the link

http://www.devarticles.com/art/1/68

Good luck!

Reply With Quote
  #3  
Old December 6th, 2002, 04:01 AM
steve55 steve55 is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Location: UK
Posts: 44 steve55 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via AIM to steve55 Send a message via Yahoo to steve55
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..

Reply With Quote
  #4  
Old December 6th, 2002, 06:02 AM
Gee Gee is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Posts: 61 Gee User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
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.

Reply With Quote
  #5  
Old December 6th, 2002, 09:19 AM
steve55 steve55 is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Location: UK
Posts: 44 steve55 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via AIM to steve55 Send a message via Yahoo to steve55
That would be great - thanks.

Reply With Quote
  #6  
Old December 6th, 2002, 01:12 PM
eloso eloso is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Posts: 6 eloso User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question

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!

Reply With Quote
  #7  
Old December 6th, 2002, 01:52 PM
FrankieShakes FrankieShakes is offline
Frank The Tank!
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: Jun 2002
Location: Toronto, Canada
Posts: 1,246 FrankieShakes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Send a message via ICQ to FrankieShakes Send a message via MSN to FrankieShakes
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

Reply With Quote
  #8  
Old December 7th, 2002, 08:43 AM
steve55 steve55 is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Location: UK
Posts: 44 steve55 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via AIM to steve55 Send a message via Yahoo to steve55
Thanks for your help guys.

Reply With Quote
  #9  
Old December 9th, 2002, 04:43 PM
Kanu Kanu is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Posts: 91 Kanu User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
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?

Reply With Quote
  #10  
Old January 5th, 2003, 02:51 PM
maurocubaque maurocubaque is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: Bogota
Posts: 2 maurocubaque User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via Yahoo to maurocubaque
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

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > Binary Schminery


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT