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 4 of 4

Thread: alignment

  1. #1
    New Coder
    Join Date
    Jun 2005
    Posts
    96
    Thanks
    0
    Thanked 0 Times in 0 Posts

    alignment

    i dont know if this should go in php or html..but whatever

    heres the deal..

    i have a form where users input their name and can upload a pic from their HD to the server. ok, good, got that part done

    -----------------------

    the trouble im having is displaying that stuff. I need to set it up so it looks like this

    name
    image

    OR

    name
    image

    whichever is easier to do acording to the following....problems you could say
    -----------------------

    the user inputs their name, which is then stored into a text file. they are then given an option to upload an image. if they dont, a default one is used.

    so somehow using tables and rows maybe, i need to display the images with their corrisponding names. heres the php for the output

    PHP Code:
    $filename "os/thenames.txt";
                
    $handle fopen($filename"r"); //opens file
                
    $contents fread($handlefilesize($filename)); //stores file content in $contents 
                
    fclose($handle); //closes file
                
    print "$contents"//prints content

                
    $dirName "os"//opens directory
                
    $dp opendir($dirName);
                
    chdir($dirName);
                
                while (
    $currentFile !== false){
                    
    $currentFile readdir($dp);
                    
    $theFiles[] = $currentFile;
                }
                
                
    $imageFiles preg_grep("/jpg$/"$theFiles); //grabs jpg files
                
                
    foreach ($imageFiles as $currentFile){ //prints images
                    
    print "<img src='http://www.domain.com/os/$currentFile' width='150' border='1'>";
                } 
    if i dont do anything to the formating, it displays like this:

    namenamename
    imageimageimage

    now does anyone have any ideas how i can change this? please ask any questions if you dont understand, im usually not very good at explaining things...but ive been working on this since 3am and its now 5 with no results

    this whole script in general has taken me about 8 hours...(its the first big script ive writtin and i suck at php 9not to mention im anal about every detail)) any help....id be eternally grateful
    Last edited by dispector; 08-09-2005 at 12:17 PM.
    later

  • #2
    Regular Coder
    Join Date
    Nov 2004
    Location
    The Netherlands
    Posts
    551
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Use a delimiter, eg pipeline to store data, then when you show the data again explode it on the pipeline and do a foreach for the array? And how do you store wich user has wich picture?
    CATdude about IE6: "All your box-model are belong to us"

  • #3
    New Coder
    Join Date
    Jun 2005
    Posts
    96
    Thanks
    0
    Thanked 0 Times in 0 Posts
    well first of all, i have no idea what you just said

    and second, its basically just based on the first name in the text file prints, then the first image prints, so they just line up

    (but now that i think of it, its not very efficient because the default image (for users who dont upload an image) is saved as (for example) 4.jpg and 9.jpg, etc.)
    later

  • #4
    New Coder
    Join Date
    Jun 2005
    Posts
    96
    Thanks
    0
    Thanked 0 Times in 0 Posts
    omg...all i gotta do is explode it into an array........im retarted
    later


  •  

    Posting Permissions

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