In this tutorial, where I'm learning how to make a gallery in PHP and MySQL, I have got an error.
This is the error that I get:
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in C:\xampp\htdocs\mikkel\galleri\functions.php on line 56
.
I just can't figure out where this error is, in the script!
Firstly, this is the link to the script:
http://www.tutorialtoday.com/read_tutorial/5751/2/?
Secondly, here is the functions.php that I got:
<?php
function count_total_images($pics) {
$count = 0;
foreach($pics as $file) {
$type = strtolower(strrchr($file, '.'));
$name = substr($file, 0, -4);
$ending = substr($name, -6);
if(($type == '.jpg' || $type == '.gif' || $type == '.png') && $ending != '_thumb') {
$count++;
}
}
return $count;
}
function show_main($path, $pics, $width, $height) {
foreach($pics as $value) {
$name = substr($value, 0, -4);
$ending = substr($name, -6);
if($ending !== '_thumb') {
echo '<a id="fulllink" target="_blank" href="'.$path.$value.'"><img id="full" src="'.$path.$value.'" width="'.$width.'" height="'.$height.'" /></a><br />';
break;
}
}
}
function show_thumbnails($total, $path, $pics, $twidth, $theight) {
echo '<a href="javascript:prev('.$total.')" style="font-size: 30px;"><</a>';
foreach($pics as $value) {
$fullpath = $path.$value;
$type = strtolower(strrchr($fullpath, '.'));
list($width, $height) = getimagesize($fullpath);
$image_p = imagecreatetruecolor($twidth, $theight);
$name = substr($value, 0, -4);
$ending = substr($name, -6);
// skip the thumbnails
if($ending !== '_thumb') {
$i++;
// create a thumbnail if we need to
if(!file_exists($path.$name.'_thumb'.$type)) {
if($type == '.gif') {
$image = imagecreatefromgif($fullpath);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $twidth, $theight, $width, $height);
imagegif($image_p, $path.$name.'_thumb'.$type);
}elseif($type == '.jpg') {
$image = imagecreatefromjpeg($fullpath);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $twidth, $theight, $width, $height);
imagejpeg($image_p, $path.$name.'_thumb'.$type);
}else{
$image = imagecreatefrompng($fullpath);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $twidth, $theight, $width, $height);
imagepng($image_p, $path.$name.'_thumb'.$type);
}
}
if($i > 5) {
echo '<a href="javascript:show_full(''.$path.$name.$type.'')"><img width="'.$twidth.'" height="'.$theight.'" id="thumb_'.$i.'" style="display:none;margin: 10px 2px 0px 2px;border:0px;" src="'.$path.$name.'_thumb'.$type.'" alt="" /></a>';
}else{
echo '<a href="javascript:show_full(''.$path.$name.$type.'')"><img width="'.$twidth.'" height="'.$theight.'" id="thumb_'.$i.'" style="margin: 10px 2px 0px 2px;border:0px;" src="'.$path.$name.'_thumb'.$type.'" alt="" /></a>';
}
}
}
echo '<a href="javascript:next('.$total.')" style="font-size: 30px;"></a>';
}
?>
Any help at all would be with a big thanks!