can anyone correct the error in this code for me please 
asked by Not Registered on 27 March 2009 16:17
Parse error: syntax error, unexpected '/', expecting ')' in /www/110mb.com/m/y/f/r/e/n/c/h/myfrenchwife/htdocs/thumb php.php on line 3
<?php
function createThumbnail ( $images/pee, $images/peethumbs, $thumbWidth20 )
{
// open the directory
$dir = opendir( $images/pee );
// loop through it, looking for any//all JPG files:
while (false !== ($fname = readdir( $dir ))) {
// parse path for the extension
$info = pathinfo($images/pee . $fname);
// continue only if this is a JPEG image
if ( strtolower($info['extension']) == 'jpg' )
{
echo "Creating thumbnail for {$fname} <br />";
// load image and get image size
$img = imagecreatefromjpeg( "{$images/pee}{$fname}" );
$width = imagesx( $img );
$height = imagesy( $img );
// calculate thumbnail size
$new_width = $20;
$new_height = floor( $height * ( $20 / $width ) );
// create a new temporary image
$tmp_img = imagecreatetruecolor( $new_width, $new_height );
// copy and resize old image into new image
imagecopyresized( $tmp_img, $img, 0, 0, 0, 0, $new_width, $new_height, $width, $height );
// save thumbnail into a file
imagejpeg( $tmp_img, "{$images/peethumbs}{$fname}" );
}
}
// close the directory
closedir( $dir );
}
// call createThumb function and pass to it as parameters the path
// to the directory that contains images, the path to the directory
// in which thumbnails will be placed and the thumbnail's width.
// We are assuming that the path will be a relative path working
// both in the filesystem, and through the web for links
createThumbs("upload/images/pee","upload/thumbs/images/peethumbs",100);
?>
<?php
function createGallery( $images/pee, $images/peethumbs );
{
echo "Creating gallery.html <br />";
$output = "<html>";
$output .= "<head><title>Thumbnails</title></head>";
$output .= "<body>";
$output .= "<table cellspacing=\"0\" cellpadding=\"2\" width=\"500\">";
$output .= "<tr>";
// open the directory
$dir = opendir( $images/peethumbs );
$counter = 0;
// loop through the directory
while (false !== ($fname = readdir($dir)))
{
// strip the . and .. entries out
if ($fname != '.' && $fname != '..')
{
$output .= "<td valign=\"middle\" align=\"center\"><a href=\"{$images/pee}{$fname}\">";
$output .= "<img src=\"{$images/peethumbs}{$fname}\" border=\"0\" />";
$output .= "</a></td>";
$counter += 1;
if ( $counter % 4 == 0 ) { $output .= "</tr><tr>"; }
}
}
// close the directory
closedir( $dir );
$output .= "</tr>";
$output .= "</table>";
$output .= "</body>";
$output .= "</html>";
// open the file
$fhandle = fopen( "gallery.html", "w" );
// write the contents of the $output variable to the file
fwrite( $fhandle, $output );
// close the file
fclose( $fhandle );
}
// call createGallery function and pass to it as parameters the path
// to the directory that contains images and the path to the directory
// in which thumbnails will be placed. We are assuming that
// the path will be a relative path working
// both in the filesystem, and through the web for links
createGallery("upload/images/pee","upload/thumbs/images/peethumbs");
?>
<?php
function createThumbnail ( $images/pee, $images/peethumbs, $thumbWidth20 )
{
// open the directory
$dir = opendir( $images/pee );
// loop through it, looking for any//all JPG files:
while (false !== ($fname = readdir( $dir ))) {
// parse path for the extension
$info = pathinfo($images/pee . $fname);
// continue only if this is a JPEG image
if ( strtolower($info['extension']) == 'jpg' )
{
echo "Creating thumbnail for {$fname} <br />";
// load image and get image size
$img = imagecreatefromjpeg( "{$images/pee}{$fname}" );
$width = imagesx( $img );
$height = imagesy( $img );
// calculate thumbnail size
$new_width = $20;
$new_height = floor( $height * ( $20 / $width ) );
// create a new temporary image
$tmp_img = imagecreatetruecolor( $new_width, $new_height );
// copy and resize old image into new image
imagecopyresized( $tmp_img, $img, 0, 0, 0, 0, $new_width, $new_height, $width, $height );
// save thumbnail into a file
imagejpeg( $tmp_img, "{$images/peethumbs}{$fname}" );
}
}
// close the directory
closedir( $dir );
}
// call createThumb function and pass to it as parameters the path
// to the directory that contains images, the path to the directory
// in which thumbnails will be placed and the thumbnail's width.
// We are assuming that the path will be a relative path working
// both in the filesystem, and through the web for links
createThumbs("upload/images/pee","upload/thumbs/images/peethumbs",100);
?>
<?php
function createGallery( $images/pee, $images/peethumbs );
{
echo "Creating gallery.html <br />";
$output = "<html>";
$output .= "<head><title>Thumbnails</title></head>";
$output .= "<body>";
$output .= "<table cellspacing=\"0\" cellpadding=\"2\" width=\"500\">";
$output .= "<tr>";
// open the directory
$dir = opendir( $images/peethumbs );
$counter = 0;
// loop through the directory
while (false !== ($fname = readdir($dir)))
{
// strip the . and .. entries out
if ($fname != '.' && $fname != '..')
{
$output .= "<td valign=\"middle\" align=\"center\"><a href=\"{$images/pee}{$fname}\">";
$output .= "<img src=\"{$images/peethumbs}{$fname}\" border=\"0\" />";
$output .= "</a></td>";
$counter += 1;
if ( $counter % 4 == 0 ) { $output .= "</tr><tr>"; }
}
}
// close the directory
closedir( $dir );
$output .= "</tr>";
$output .= "</table>";
$output .= "</body>";
$output .= "</html>";
// open the file
$fhandle = fopen( "gallery.html", "w" );
// write the contents of the $output variable to the file
fwrite( $fhandle, $output );
// close the file
fclose( $fhandle );
}
// call createGallery function and pass to it as parameters the path
// to the directory that contains images and the path to the directory
// in which thumbnails will be placed. We are assuming that
// the path will be a relative path working
// both in the filesystem, and through the web for links
createGallery("upload/images/pee","upload/thumbs/images/peethumbs");
?>
Answers
you are not allowed to have a "/" in a variable name, see http://de3.php.net/manual/en/language.variables.basics.php
Change it from $images/pee to $images_pee and so on
Change it from $images/pee to $images_pee and so on
answered by Not Registered on 30 March 2009 17:49
source: http://de3.php.net/manual/en/language.variables.basics.php
source: http://de3.php.net/manual/en/language.variables.basics.php
- What is: Failed opening 'includes/languages/english/' for inclusion , Not Registered
- PHP Fatal erro, Not Registered
- what does phpBB : CRITICAL ERROR MEAN, Not Registered
- Undefined index: language in, Not Registered
- what does following message mean: Fatal error: Call to undefined function validip () in, Not Registered
- what does this error mean, Not Registered
- just error..help me pls, Not Registered
- i have the following error plz tell me the solution, Not Registered
- PHP Error message.what does it mean?, Not Registered
- what does unexpected $end mean?, Not Registered
- No permission to access /php/php-cgi.exe, Not Registered
- What does this php message mean, Not Registered
- What does this php message mean, Not Registered
- is a php error a hosting issue?, Not Registered
- How to redirect to custom error page if any php script error, Not Registered
- syntax error close to a double quote (") - none on page, Not Registered
- What does this error message mean?, Not Registered
- plz solve this , Sajid Ali
- Why is this happening?, Not Registered
- PHP Download error, Not Registered
- php error 56, Not Registered
- Can you help solve unexpected $end, Not Registered
- What shall i do i got this message when submitting my registration form to a website.Im just an ordinary computer user, Not Registered
- PHP error, Not Registered


















