can anyone correct the error in this code for me please this question feed

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");
?>

Answers

Thumb_up
Thumb_down

0%
0%
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

nicht registriert  [login]




spam prevention: please repeat the code displayed below
Cryptographp PictureReload



Search
   

question tags

Bookmark this page Wong Linkarena Webnews Delicious Technorati Furl Yahoo_myweb Google_bmarks Blinklist Magnolia Windows_live Digg Netscape Stumbleupon Newsvine Reddit Tailrank Spurl Yigg