Jump to content

joshberm

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

joshberm's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I'm very new to PHP.... I really am not sure what you mean. Can you give me an example of the syntax needed to actually REMOVE the unwanted values?
  2. Hello all.... hoping somebody can help me with this.  I've got a little image swapper script I'm trying to install.  The image displaying and swapping part works, but what I need to figure out is how to hide certain images. I pass $usepic1 and $usepic2 etc. into the function as 'yes' or 'no'.  These will be used to create an array to hold the image source, thumbnail source, and ALT text. What I'd like to do is filter this array so that the 'blank' records are removed completely.  Then re-order the array so that $i can start at 0 and display all the results.  Any other suggestions would be appreciated. I have tried setting the $imagesArray["thumbsrc"][0] to empty single quotes, and this would seem to be the easiest way.  Firefox hides the image altogether but IE displays the red X placeholder image. I'm pretty new to all this, so I would really appreciate any ideas.  Thanks! function slideshow($usepic1, $usepic2, $usepic3, $usepic4, $usepic5, $usepic6, $idoflink, $titleoflink, $urlofdirectory) { $imagesArray=array(); if ($usepic1 == 'yes') { $imagesArray["thumbsrc"][0]=$urlofdirectory . '/thumbnail.php?id=' . $idoflink . '&field=attachpic1'; $imagesArray["src"][0]=$urlofdirectory . '/download.php?id=' . $idoflink . '&field=attachpic1'; $imagesArray["alt"][0]=$titleoflink; } else { $imagesArray["thumbsrc"][0]='blank'; } if ($usepic2 == 'yes') { $imagesArray["thumbsrc"][1]=$urlofdirectory . '/thumbnail.php?id=' . $idoflink . '&field=attachpic2'; $imagesArray["src"][1]=$urlofdirectory . '/download.php?id=' . $idoflink . '&field=attachpic2'; $imagesArray["alt"][1]=$titleoflink; } else { $imagesArray["thumbsrc"][1]='blank'; } if ($usepic3 == 'yes') { $imagesArray["thumbsrc"][2]=$urlofdirectory . '/thumbnail.php?id=' . $idoflink . '&field=attachpic3'; $imagesArray["src"][2]=$urlofdirectory . '/download.php?id=' . $idoflink . '&field=attachpic3'; $imagesArray["alt"][2]=$titleoflink; } else { $imagesArray["thumbsrc"][2]='blank'; } if ($usepic4 == 'yes') { $imagesArray["thumbsrc"][3]=$urlofdirectory . '/thumbnail.php?id=' . $idoflink . '&field=attachpic4'; $imagesArray["src"][3]=$urlofdirectory . '/download.php?id=' . $idoflink . '&field=attachpic4'; $imagesArray["alt"][3]=$titleoflink; } else { $imagesArray["thumbsrc"][3]='blank'; } if ($usepic5 == 'yes') { $imagesArray["thumbsrc"][4]=$urlofdirectory . '/thumbnail.php?id=' . $idoflink . '&field=attachpic5'; $imagesArray["src"][4]=$urlofdirectory . '/download.php?id=' . $idoflink . '&field=attachpic5'; $imagesArray["alt"][4]=$titleoflink; } else { $imagesArray["thumbsrc"][4]='blank'; } if ($usepic6 == 'yes') { $imagesArray["thumbsrc"][5]=$urlofdirectory . '/thumbnail.php?id=' . $idoflink . '&field=attachpic6'; $imagesArray["src"][5]=$urlofdirectory . '/download.php?id=' . $idoflink . '&field=attachpic6'; $imagesArray["alt"][5]=$titleoflink; } else { $imagesArray["thumbsrc"][4]='blank'; } $useImage=1; // set default image value (equal to array index number) if(isset($_REQUEST)){ while(list($key,$val)=each($_REQUEST)){   if(strstr($key,"_img_x")){   $useImage=str_replace("_img_x","",$key);   break;   } } } echo '<form method="post" action="' . $_SERVER["PHP_SELF"] . '" id="imageSwapperForm" onsubmit="return false">'; for($i = 0; $i < count($imagesArray["src"]); $i++){ echo '<input style="border: 0; margin: 15px" type="image" name="'.$i.'_img" value="'.$i.'_img" src="'.$imagesArray["thumbsrc"][$i].'" alt="'.$imagesArray["alt"][$i].'" onclick="document.getElementById(\'img\').src=\''.$imagesArray["src"][$i].'\'; document.getElementById(\'img\').alt=this.alt">'; } echo '<p><img id="img" src="' . $imagesArray["src"][$useImage] . '" border="0" alt="' . $imagesArray["alt"][$useImage] . '"></p></form>'; }
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.