Printer Friendly Version Print this thread
Email this thread to a friend eMail this thread to a friend
  • Are directories better than files? (In: Google)
  • Featured Web Site Template

    Hundreds More at Free Site Templates.com!

    Web Site Partners
    Sponsored Links
    Jet City Software
     
    Whos Here ?
    Reflects user activity within the last 5 minutes
    Moderator(s): Prowler, jcokos
    Member Message

    gal
    Joined: Eons Ago
    # Posts: 1148

    View the profile for gal Send gal a private message

    Posted: 2004-Oct-19 16:14
    Edit Message Delete Message Reply to this message

    I have a thumbnail pic that allows you to click on it for additional pictures. That will take you to an html file that contains the additional pics. I created a php command that will pass the item_number to a php file that will dynamically create the additional pics page. This way, some work has been cut out.

    The problem is that I will sometimes have 2, 4, 6, 8 additional pictures. All pics are named the same item_number-1.jpg, item_number-2.jpg--where the item_number is dynamic [but the same for every pic on the page], and the "1", "2", etc. is for each picture. Is there a way to check to see if the next picture number jpg exists in the folder, and stop if it doesn't? This way the page will be OK for any number of pictures.

    I would rather not have different php files for the different number of pictures.



    gal
    Joined: Eons Ago
    # Posts: 1148

    View the profile for gal Send gal a private message

    Posted: 2004-Oct-19 17:33
    Edit Message Delete Message Reply to this message

    Well, I thought I had found the solution. I have tried the following, and everything works fine except I get the error:

    "The file http://www.mysite.com/graphics/rg874x400.jpg does not exist."

    The file name is accurate and the file does exist?



    Code: [copy]





    I'm a bit baffled and don't know where to go from here.



    langard
    Joined: Dec 15, 1999
    # Posts: 339

    View the profile for langard Send langard a private message

    Posted: 2004-Oct-19 22:38
    Edit Message Delete Message Reply to this message

    You might try something like this. You'll have to troubleshoot it 'cause I just wrote it here for you as an example.

    The function checks to see if the file exists (up to ten pics), then puts it into an array and returns it.

    The display calls the function, parses the array, gets the picture width and height, then outputs it to the screen.

    //*************************
    //Picture Function
    //*************************

    function ShowPics($ItemNum){
    $PicArray = array();
    for($i=0; $i<=10; $i++){
    $Pic = $ItemNum . "-" . $i . ".jpg";
    if(file_exists("/graphics/$Pic"wink){
    $PicArray[] = $Pic;
    }
    }
    return $PicArray;
    }//endShowPics

    //*************************
    //Picture Display
    //*************************

    $DisplayPics = ShowPics($_POST["item_num"]);

    foreach($DisplayPics as $PicKey => $PicFile){
    $ImgSize = getimagesize($PicFile);
    $ImgSizeX = $ImgSize[0];
    $ImgSizeY = $ImgSize[1];

    echo "<img src='$PicFile' width='$ImgSizeX' height='$ImgSizeY' alt='' border='0' vspace='5'><br>";
    }//endforeach


    [ Message was edited by: langard 10/19/2004 02:48 pm ]





    g1smd
    Staff
    Joined: Jul 28, 2002
    # Posts: 10418

    View the profile for g1smd Send g1smd a private message

    Posted: 2004-Oct-30 16:15
    Edit Message Delete Message Reply to this message

    Did that help?



    Is your script looking in the right folder for the image?


    You are not permitted to post messages in this forum or topic, because of one or more of the following reasons:
    1. You have not yet logged in, or registered properly as a member
    2. You are a member, but no longer have posting rights.
    3. This is a private forum, for which you do not have permissions.

    If you are a recent member, it's possible that you simply have not yet confirmed your account. Please check your email for a message entitled 'JimWorld Forums: Confirm Your Account' and follow the instructions contained within.

    If you cannot find this message, click here to Re-Send it.

    If you are still experiencing problem, please read the Login Assistance Article for some advice on what may be causing your login not to work properly.

    Switch to Advanced Editor and ... Create a New Topic or Reply to this Thread

    New posts Forum is locked
    © 1995  ·  iWeb, Inc  ·  DBA JimWorld Productions