SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Zealot javierccs's Avatar
    Join Date
    Feb 2005
    Location
    Venezuela
    Posts
    144
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smile Showing images from server

    hi.....
    im new in php, i just manage to save images with a form in the server, the images won't be in the database but will be saved in a file in the server depending the user id (i have a database wich stores the personal information of the users), the picture is supposed to be shown when a user demands information of another user(like a directory......well...it's really a directory), now the question is, how do i show the picture in the page that shows the personal information of another user is it is stored in a file of the server.....?, each user has a file of his own and he can only save iamges of him7herself.......i would apreciate any regarding information ....
    ...run Forrest....run!!

  2. #2
    Twitter: @TimIgoe silver trophy TimIgoe's Avatar
    Join Date
    Feb 2005
    Location
    Blackpool, UK
    Posts
    1,058
    Mentioned
    27 Post(s)
    Tagged
    1 Thread(s)
    Assuming you've not processed the uploaded file in anyway, and it is just an image... just put an img tag in there linking to it based on (for e.g.) userid if thats how you store the images - 1 per person?

  3. #3
    SitePoint Zealot javierccs's Avatar
    Join Date
    Feb 2005
    Location
    Venezuela
    Posts
    144
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question

    hi thank you for responding.....yes...for the momment i have not processed the uploaded file in anyway, but it must only allow to upload images in jpg format, so im working on it, how do i manage to put and image tag??, im coming from asp.net and and really new in this linux wordl wich i think its the face of the future, thank you for responding to my post again....
    ...run Forrest....run!!

  4. #4
    Twitter: @TimIgoe silver trophy TimIgoe's Avatar
    Join Date
    Feb 2005
    Location
    Blackpool, UK
    Posts
    1,058
    Mentioned
    27 Post(s)
    Tagged
    1 Thread(s)
    something as simple as
    PHP Code:
    print "<img src=\"images/user" $ResultsRow['user_id'] . ".jpg\" />"
    would suffice, assuming you had a result row with the user ID otherwise, you'll have to get one.

  5. #5
    SitePoint Zealot javierccs's Avatar
    Join Date
    Feb 2005
    Location
    Venezuela
    Posts
    144
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok that's it, but what happens if an user uploads two different photos, the directory must show only one, do you think i coud rename the photo, for instance 'userphoto.jpg' once its uploaded and then :
    PHP Code:
    print "<img src=\"images/user" $ResultsRow['user_id'] . "userphoto.jpg\" />"

    how do you yhink, if is not a bother, i could change the file name in the uploading momment??
    ...run Forrest....run!!

  6. #6
    Twitter: @TimIgoe silver trophy TimIgoe's Avatar
    Join Date
    Feb 2005
    Location
    Blackpool, UK
    Posts
    1,058
    Mentioned
    27 Post(s)
    Tagged
    1 Thread(s)
    It depends if you need to keep a 'back copy' of old photos, if you don't... why not just overwrite the old one?

    If you do. then, i suppose u'll have to check if a file exists, and increment a coiunter until there is a 'free' space. e.g. have the first pick $userid-1.jpg and then the second would be $userid-2.jpg etc.

  7. #7
    SitePoint Zealot javierccs's Avatar
    Join Date
    Feb 2005
    Location
    Venezuela
    Posts
    144
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thank you again,

    no, a user can upload only one picture(for the presente time) because you see, that pioture is gonna be shown in the directory, and if he has more than one, how can the page pick wich one is gonna show?, of course it can be done with more than one pictures, but simplifying the picture shown code, these are the needes, one photo so i can rename it, like 'userphoto.jpg' and then its a code to show just the file marked as 'userphoto.jpg' that way i think it should be easier, dont know.....is it?.....what do you think???
    ...run Forrest....run!!

  8. #8
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Moved to a more appropriate forum. See Where should I post my thread? for details

    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature


Bookmarks

Posting Permissions

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