#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Posts
    4
    Rep Power
    0
    Below is the code I have at my site that puts either gif or jpeg into the pages according to which is in the folder. It does not work. It only will recognize the jpg's. I want it to recognize both at the same time and input them onto the screen. Anyone out there with advice? The site is gametour.com and this the screenshots script for the reviews.I do not know PHP yet and this script was written by someone who no longer wants to help us.
    defender@atari.net


    <?
    function screenshot(){
    clearstatcache;
    global $folder,$prefix;

    $screenshots=array();
    $i=1;
    $k=0;
    while ($i<7):
    if ($i==4) { print "<br>";}
    $screengif="$folder"."$prefix"."$i".".gif";
    $screenjpg="$folder"."$prefix"."$i".".jpg";
    if (file_exists('$screengif')){
    $k++;
    print "<img src="$screengif" width="160" height="119" hspace="3" vspace="3">";
    }
    elseif(file_exists("$screenjpg")){
    $k++;
    print "<img src="$screenjpg" width="160" height="119" hspace="3" vspace="3">";
    /* array_push($screenjpg);*/
    }


    $i++;
    endwhile;

    if ($k==0){
    print "No screenshots available for this title.";
    }

    }
    ?>
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2000
    Location
    Ontario, Canada
    Posts
    498
    Rep Power
    18
    elseif(file_exists('$screengif'))

    should be

    elseif(file_exists($screengif))

    The single quotes don't parse the variable, so it looks for $screengif itself, and not the variable's value. To parse the variable, don't use quotes at all.


    ------------------
    To alcohol! The cause of, and solution to, all of life's problems. -- Homer Simpson

    [This message has been edited by cka (edited August 21, 2000).]

    [This message has been edited by cka (edited August 21, 2000).]
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Posts
    4
    Rep Power
    0
    Thank you very much! It is now working 100%...Ahh..the PHP satisfaction.

Similar Threads

  1. Problem with image resizing
    By willms_jay in forum PHP Development
    Replies: 0
    Last Post: February 12th, 2004, 12:23 AM
  2. changing image src with input field and javascript
    By benthekiller in forum JavaScript Development
    Replies: 4
    Last Post: January 15th, 2004, 02:19 AM
  3. dynamic onchange image preview
    By Sotonin in forum HTML Programming
    Replies: 5
    Last Post: December 30th, 2003, 11:58 AM
  4. Replies: 2
    Last Post: December 20th, 2003, 11:56 AM
  5. IPtables help for rh8
    By climber in forum Linux Help
    Replies: 0
    Last Post: December 1st, 2003, 09:26 PM

IMN logo majestic logo threadwatch logo seochat tools logo