Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-31-2006, 02:35 AM   PM User | #1
van21691
New Coder

 
Join Date: Oct 2006
Posts: 68
Thanks: 3
Thanked 0 Times in 0 Posts
van21691 is an unknown quantity at this point
Image saving

I have a site that let other upload their image on my site. http://www.iwanto.getmypage.com/img/img/index.php
Now, I need help with saving the image so the registered member can retreive the image code
Any help
Thank you
van21691 is offline   Reply With Quote
Old 10-31-2006, 05:46 PM   PM User | #2
homerUK
Regular Coder

 
Join Date: Nov 2002
Location: Manchester, UK
Posts: 533
Thanks: 4
Thanked 1 Time in 1 Post
homerUK is an unknown quantity at this point
if it's already being uploaded, just write the path to a database against the user who is uploading it?

so if userID = 100, just store the image path something like "uploads/images/filename.jpg" then the user could use that.

is that what you mean?
__________________
www.mattfacer.com
homerUK is offline   Reply With Quote
Old 11-01-2006, 01:54 AM   PM User | #3
van21691
New Coder

 
Join Date: Oct 2006
Posts: 68
Thanks: 3
Thanked 0 Times in 0 Posts
van21691 is an unknown quantity at this point
http://www.iwanto.getmypage.com/img/img/reg/index.php
try to log-in,
username: admin
password: admin

then upload some pic please a small file. after uploading i want the uploaded pic to be shown on the homepage of the logged members
van21691 is offline   Reply With Quote
Old 11-01-2006, 07:29 AM   PM User | #4
homerUK
Regular Coder

 
Join Date: Nov 2002
Location: Manchester, UK
Posts: 533
Thanks: 4
Thanked 1 Time in 1 Post
homerUK is an unknown quantity at this point
ok I uploaded an image and it gave me the url to the uploaded image. All you need to do is save the image name which you generate, then put that in an images table. A structure such as

imageID
userID
image_path
date_uploaded
size
etc. etc.

Then when the user logs in, just so a query to say

SELECT * FROM images WHERE userID = $userID

(where $userID is the user who is logged in)

then loop through the results displaying the image

PHP Code:
while ($row mysql_fetch_array($result)) {
    echo 
"<img src='".$row['image_path']."' />";

something like that would work ok?
__________________
www.mattfacer.com
homerUK is offline   Reply With Quote
Old 11-01-2006, 03:07 PM   PM User | #5
van21691
New Coder

 
Join Date: Oct 2006
Posts: 68
Thanks: 3
Thanked 0 Times in 0 Posts
van21691 is an unknown quantity at this point
Quote:
Originally Posted by homerUK View Post
All you need to do is save the image name which you generate, then put that in an images table. A structure such as

imageID
userID
image_path
date_uploaded
size
etc. etc.
Do I have to create an mysql table for imageID, userID, etc. etc.?
van21691 is offline   Reply With Quote
Old 11-01-2006, 03:20 PM   PM User | #6
homerUK
Regular Coder

 
Join Date: Nov 2002
Location: Manchester, UK
Posts: 533
Thanks: 4
Thanked 1 Time in 1 Post
homerUK is an unknown quantity at this point
I assume you've already got a table with members' details in? (used for the login)

so yes I would create another mysql table for the images.
__________________
www.mattfacer.com
homerUK is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:09 PM.


Advertisement
Log in to turn off these ads.