Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6

Thread: Image saving

  1. #1
    New Coder
    Join Date
    Oct 2006
    Posts
    68
    Thanks
    3
    Thanked 0 Times in 0 Posts

    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

  • #2
    Regular Coder
    Join Date
    Nov 2002
    Location
    Manchester, UK
    Posts
    533
    Thanks
    4
    Thanked 1 Time in 1 Post
    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?

  • #3
    New Coder
    Join Date
    Oct 2006
    Posts
    68
    Thanks
    3
    Thanked 0 Times in 0 Posts
    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

  • #4
    Regular Coder
    Join Date
    Nov 2002
    Location
    Manchester, UK
    Posts
    533
    Thanks
    4
    Thanked 1 Time in 1 Post
    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?

  • #5
    New Coder
    Join Date
    Oct 2006
    Posts
    68
    Thanks
    3
    Thanked 0 Times in 0 Posts
    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.?

  • #6
    Regular Coder
    Join Date
    Nov 2002
    Location
    Manchester, UK
    Posts
    533
    Thanks
    4
    Thanked 1 Time in 1 Post
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •