Skip to main content
Inspiring
March 15, 2007
Answered

error image_window.php

  • March 15, 2007
  • 1 reply
  • 278 views
i have this script : image_window.php which keeps giving me this error :

-This script must receive a valid image name!
Close This Window

when i open images.php , everything's fine , as you can see by clicking this link : http://therainbowpride.com/myphp2/images.php

This is my script, i looked over and over and just can't seem to find where is the error, could it be a space ?
Can someone have a look at it , maybe an extra pair of eyes would help me. Thank you so much

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns=" http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>View Image</title>
</head>
<body>
<?php # Script 11.3 - image_window.php

// Set a variable for problem reporting.
$okay = FALSE;

// Make sure an image name was passed to the script.

if (isset($_GET['image'])) {

// Get the extension of the image name.
$ext = substr ($_GET['image'], -4);

// Test if it's a valid image extension.
if ((strtolower($ext) == '.jpg') OR (strtolower($ext) == 'jpeg') OR (strtolower($ext) == '.gif')) {

// Get the image information and display the image.
if ($image = @getimagesize ('uploads/' . $_GET['image'])) {
echo "<img src=\"uploads/{$_GET['image']}\" $image[3] border=\"2\" />";
$okay = TRUE; // No problems.
}

} // End of extension IF.

} // End of isset() IF.

// If something went wrong...
if (!$okay) {
echo '<div align="center"><font color="#FF0000" size="+1">This script must receive a valid image name!</font></div>';
}
?>
<br />
<div align="center"><a href="javascript: self.close();">Close This Window</a></div>
</body>
</html>






This topic has been closed for replies.
Correct answer LuisDesigns
Problem solved. I've decided to take a 30 minute break and when i came back i found out that in my images.php script i had the '$' sign missing before 'image'.

Thank you guys

1 reply

LuisDesignsAuthorCorrect answer
Inspiring
March 15, 2007
Problem solved. I've decided to take a 30 minute break and when i came back i found out that in my images.php script i had the '$' sign missing before 'image'.

Thank you guys