Random image combined with resizing :O

Hello all! Thank you in advance for reading through my little problem. I am knew to PHP but have used other scripts in the past and I have been building off of what I know and is familiar. I managed to dig up this random image generator for my website (the first code) which was extremely helpful. Now I just need to figure out how to re-size the image to a default width, so that it fits my web page! I did find this code for resizing (second code), but I cannot seem to figure out how to implement it into the random image code D: An explanation would be helpful, but what I really need is a “solution code”, if you will. Thank you very much again!

Number one (random image):

<?php $images = 4628; $path = "RandomSearch/"; $random = rand(1,$images); echo "" ?>

Number two (resizing):

$images = “…/path/fileName.gif”;
if (file_exists($image))
{
list($width) = getimagesize($image);
// set the maximum width of the image here
$maxWidth = 700;
if ($width > $maxWidth)
{
echo “

<img alt=“Image” width=”$maxWidth" src="$images" />";
}
else
{
echo “

<img alt=“Image” src=”$image" />

\n";
}
}
else
{
echo “

Image does not exist

”;
}
Sponsor our Newsletter | Privacy Policy | Terms of Service