качени, но ги показва / gallery q

crystalline

Registered
ето този код по-долу ми представлява галерията...
ии попринцип си работеше...сега обаче като сложа изображение в папката (files) ми бута грешка на 386 ред.

http://www.eg-dobrich.com/etwinning/yailata/working gallery1/gallery111.php
самите изображения са качени, но явно не може да си покаже...нямам представа защо...
това става когато кача през ФТП и кагато кача през ъплоуд формата, която работи.
http://www.eg-dobrich.com/etwinning/yailata/working gallery1/upload111.php

самата папка files ми е на 777 през файързилата..дори пробвах да сложа и самите файлове gallery111.php и upload111.php на 777 (в момента са така), но нямаше ефект.

на локал хост всичко си е ок

Код:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

<title>- Фотогалерия - Национален Археологически Резерват Яйлата - </title>

<style type="text/css">
body {
	font-size:8pt; 
	color:black;
	font-family:verdana,arial,helvetica,san-serif;
	background-color:white;
	}

td.border {
	border:0px solid;
	font-size:9pt;
	padding:3px;
	}

table {
	border-collapse: collapse;
	}
.page {
	text-decoration:none;
	}

a.page:hover {
	text-decoration:underline;
	
	}

.spacer {
	border:0px #808080 solid;
	font-size:10pt;
	background-color:#;
	}

</style>

<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">

</head>
<body>



<table border="0" cellpadding="0" cellspacing="0" align="center">

<?php
// date: 5/11/2004
// version: 1.01
// description: gallery script that creates it's own thumbnails if GD or imagemagick is installed
// license: freeware under: http://www.ricocheting.com/policy.html


// max image width/height
$config['size'] = 130;
// kachestvo na jpeg thumbnails
$config['imagequality'] = 70;

//  broi redeove za tranica 
$config['rows'] = 5;

// broi koloni za stranica 
$config['cols'] = 4;

// max broi stranici pokazani navednuj 
$config['maxShow'] = 10;

$config['start'] = 0;
$config['max'] = 0;
$config['page'] = isset($_GET['page'])?$_GET['page']:"0";

// folder where full size images are stored (include trailing slash)
$config['fulls']="files/";

// folder where thumbnails are to be created
$config['thumbs'] = "$config[fulls]thumb";

// method to create thumbnails. options: gd1, gd2, imagemagick
$config['imagemethod'] = "gd2";             

// (if imagemagick) - Path to Imagemagick "convert" program
$config['convert'] = "/usr/bin/convert";
// (if imagemagick) - Path to Imagemagick "identify" program
$config['identify'] = "/usr/bin/identify";


#######################################################################
//see if dir exits, if not create
if(isset($_GET['entry'])){
	GetEntry();
}else{
	PrintThumbs();
}
#######################################################################


#-#############################################
# desc: prints out html for thumbnails of images in directory
function PrintThumbs(){
	global $config;

	if (!file_exists($config['fulls'])) { 
		oops("directory <b>$config[fulls]</b> does not exist");
		die;
	}
	//thumb directory
	if (!file_exists($config['thumbs'])) { 
		if (!mkdir($config['thumbs'], 0755)) {
			oops("Could not create thumb directory <b>$config[thumbs]</b> - check write permissions");
			die;
		}
	}

   $imagelist = GetFileList($config['fulls']);
//   echo count($imagelist);

	//processing for how many images to do on current page
	$config['start']=($config['page']*$config['cols']*$config['rows']);
	$config['max']=( ($config['page']*$config['cols']*$config['rows']) + ($config['cols']*$config['rows']) );

	if($config['max'] > count($imagelist)){$config['max']=count($imagelist);}

echo "<tr><td align=\"right\" colspan=\"$config[cols]\" style=\"padding:3px;\" class=\"border\">\n";
#if there is 0 matches, show 0. otherwise show ($start+1)
if ($config['max'] == "0"){echo "Showing results <b>0 - 0</b> of <b>0</b></td></tr>\n";}
else{echo "Показване на  <b>".($config['start']+1)." - $config[max]</b> от <b>".count($imagelist)."</b> въведени изображения</td></tr>\n";}


echo "<tr>";

	$temp=1;
	//for all the images on the page
	for($i=$config['start']; $i<$config['max']; $i++){


		$thumb_image = $config['thumbs']."/".$imagelist[$i];
		$thumb_exists = file_exists($thumb_image);

		// create thumb if not exist
		if(!$thumb_exists){
			
			$thumb_exists = ResizeImage("$config[fulls]$imagelist[$i]", $thumb_image, $config['size']);
		}

		$imagelist[$i] = rawurlencode($imagelist[$i]);
		$thumb_image = $config['thumbs']."/".$imagelist[$i];

		echo "<td valign=\"bottom\" align=\"center\" class=\"border\"><a href=\"$config[fulls]$imagelist[$i]\" title=\"$imagelist[$i]\" target=\"_blank\">"; 
		if ($thumb_exists) {
			echo "<img src=\"$thumb_image\" border=\"0\" alt=\"$imagelist[$i]\">";
		} else {
			echo "$imagelist[$i]";
		}
		echo "</a></td>\n";


		//if the max cols is reached, start new col
		if(($temp == $config['cols']) && ($i+1 != $config['max'])){
			echo "</tr><tr><td colspan=\"$config[cols]\" class=\"spacer\"> </td></tr><tr>\n";
			$temp=0;
		}
		$temp++;
	}//foreach img

	//if there are no results
	if($config['start'] == $config['max']){
		echo "<td align=\"center\" colspan=\"$config[cols]\" class=\"spacer\">Няма въведени изображения</td>\n";
	}
	//if there are empty "boxes" in the row (ie; last page)
	elseif($temp != $config['cols']+1){
		echo "<td align=\"center\" colspan=\"".($config['cols']-$temp+1)."\"> </td>\n";
	}


	echo "</tr>";
GetPageNumbers(count($imagelist));

}#-#PrintThumbs()


#-#############################################
# desc: grabs and prints filename
# returns: (bool) worked
function GetEntry(){
	global $config;

if(!file_exists("$config[fulls]$_GET[entry]")){
	oops("Няма въведени изображения");
	return false;
}

echo "<a href=\"$_SERVER[HTTP_REFERER]\">Back</a><br>";
echo "<img src=\"$config[fulls]$_GET[entry]\">";


}#-#GetEntry()


#-#############################################
# desc: GetFileList
# param: [optional] directory to look through
# returns: array with list of images
function GetFileList($dirname="."){
	global $config;
	$list = array(); 

	if ($handle = opendir($dirname)) {
		while (false !== ($file = readdir($handle))) { 
			if (preg_match("/\.(jpe?g|gif|png)$/i",$file)) { 
				$list[] = $file;
			} 
		}
		closedir($handle); 
	}
	sort($list);

	return $list;
}#-#GetFileList()


#-#############################################
# desc: throw an error message
# param: [optional] any custom error to display
function oops($msg) {
?>
<table align=center>
<tr><td class=header>
Грешка
</td></tr>

<tr><td class=entry>
	<br><?=$msg?>
	<br><br>
	<hr size=1 noshade width="80%" class=desc>
	<center>Моля натиснете <a href="javaScript:history.back();"><b>бутота НАЗАД</b></a> и опитайте отново.</center>

</td></tr></table>
<?php
}#-#oops()


#-#############################################
# desc: chooses method to resize image to correct ratio
# param: ($image) image reference of full size img to use ($newimage) what to save thumbnail as ($size) max width or height to resize to
# returns: (bool) if image was created
function ResizeImage($image, $newimage, $size) {
   global $config;
   
	switch ($config['imagemethod']) {
		case "imagemagick":
		return ResizeImageUsingIM($image, $newimage, $size);
			break;
		case "gd1":
		case "gd2":
			return ResizeImageUsingGD($image, $newimage, $size);
			break;
		default:
			return false;
			break;
	}
}#-#ResizeImage()


#-#############################################
# desc: resizes image if GD was used
# param: ($image) image reference of full size img to use ($newimage) what to save thumbnail as ($size) max width or height to resize to
# returns: (bool) if image was created
function ResizeImageUsingGD($image, $newimage, $size) {

	list ($width,$height,$type) = GetImageSize($image);

	if($im = ReadImageFromFile($image,$type)){
		//if image is smaller than the $size, make it actual $size
		if($height < $size && $width < $size){
			$newheight=$height;
			$newwidth=$width;
		}
		//if image height is larger, height=$size, then calc width
		else if($height > $width){
			$newheight=$size;
			$newwidth=($width / ($height/$size));//cast the resized width as int
		}
		//if image width is larger, width=$size, then calc width
		else{
			$newwidth=$size;
			$newheight=($height / ($width/$size));//cast the resized height as int
		}

		$im2=ImageCreateTrueColor($newwidth,$newheight);
		ImageCopyResampled($im2,$im,0,0,0,0,$newwidth,$newheight,$width,$height);

		if(WriteImageToFile($im2,$newimage,$type)){
			return true;
		}
	}

return false;
}#-#ResizeImageUsingGD()


#-#############################################
# desc: resizes image using imagemagick
# param: ($image) image reference of full size img to use ($newimage) what to save thumbnail as ($size) max width or height to resize to
# returns: (bool) if image was created
function ResizeImageUsingIM($image, $newimage, $size) {
   global $config; 

   Exec("$config[identify] -ping -format \"%w %h\" \"$image\"", $sizeinfo);

   if (! $sizeinfo ) {
      return false;
   }
   $size = explode(" ", $sizeinfo[0]);
   $width  = $size[0];
   $height = $size[1];

   if (!$width) {
      return false;
   }

		//if image is smaller than the 160 container, make it actual size
		if($height < $size && $width < $size){
			$newheight=$height;
			$newwidth=$width;
		}
			//if image height is larger, height=$size, then calc width
		else if($height > $width){
			$newheight=$size;
			$newwidth=($width / ($height/$size));//cast the resized width as int
		}
			//if image width is larger, width=$size, then calc width
		else{
			$newwidth=$size;
			$newheight=($height / ($width/$size));//cast the resized height as int
		}


   Exec("$config[convert] -geometry \"$newwidth"."x"."$newheight\" -quality \"$config[imagequality]\" \"$image\" \"$newimage\"");

   return file_exists($newimage);
}#-#ResizeImageUsingIM()


#-#############################################
# desc: resizes image using imagemagick
# param: ($filename) filename of image to create ($type) int of type. 1=gif,2=jpeg,3=png
# returns: binary img
function ReadImageFromFile($filename, $type) {
	$imagetypes = ImageTypes();

	switch ($type) {
		case 1 :
			if ($imagetypes & IMG_GIF){
				return $im = ImageCreateFromGIF($filename);
			}
		break;
		case 2 :
			if ($imagetypes & IMG_JPEG){
				return ImageCreateFromJPEG($filename);
			}
		break;
		case 3 :
			if ($imagetypes & IMG_PNG){
				return ImageCreateFromPNG($filename);
			}
		break;
		default:
		return 0;
	}
}#-#ReadImageFromFile()


#-#############################################
# desc: resizes image using imagemagick
# returns: binary img
function WriteImageToFile($im, $filename, $type) {
	global $config;

	switch ($type) {
		case 1 :
			return ImageGIF($im, $filename);
		case 2 :
			return ImageJpeg($im, $filename, $config['imagequality']);
		case 3 :
			return ImagePNG($im, $filename);
		default:
			return false;
	}
}#-#WriteImageToFile()


#-#############################################
# sub: GetPageNumbers
# desc: gets the pages in the list
function GetPageNumbers($entries) {
	global $config;

	$config['totalPages']=Ceil(($entries)/($config['cols']*$config['rows']));

	// echo number of pages
	echo "<tr><td colspan=$config[cols] align=center height=20 class=border>Page ($config[totalPages]): ";

	// echo out PREV
	if( ($config['page']-1) >= 0){
	echo "<a href=\"$_SERVER[SCRIPT_NAME]?page=".($config['page']-1)."\" class=page><b>«««</b></a>";}
	// else no link
	else{echo "<b>«««</b>";}

		// for each link, echo out page link
			$start=0; // starting image number
			$end=$config['totalPages']-1; // ending image number (total / number image on page)

		// cutoff size < page. or . page != last page (otherwise keep above values)
		if($config['maxShow'] < $config['page'] || (($config['cols']*$config['rows']*$config['maxShow'])< $entries) ){
			// if page >= cutoff size+1 -> start at page - cutoff size
			if($config['page'] >= ($config['maxShow']+1) && $config['page'] < $end-$config['maxShow']){ $start = $config['page']-$config['maxShow'];}
			elseif($end < $config['page']+$config['maxShow']+1 && $config['totalPages']-1 >= $config['maxShow']*2+1){$start = $config['totalPages']-1-$config['maxShow']*2;}
			else{$start=0;} // else start at 0
			
			// if page+cutoff+1 > number of pages total -> end= number of pages total
			if( $config['page']+$config['maxShow']+1 > $config['totalPages']-1 ){$end = $entries/($config['cols']*$config['rows']);}
			#&oops("$end,$config['maxShow']");
			elseif($start == 0 && $end > $config['maxShow']*2){$end = $config['maxShow']*2;}
			elseif($start == 0 && $config['totalPages'] <= $config['maxShow']*2){$end = $config['totalPages']-1;}
			else{$end = ($config['page']+$config['maxShow']);} //end = page+cutoff+1
		}


	// echo out divide marker
	if($start > 0){echo " ... ";}
	else{echo " - ";}


	// echo out each of the numbers
	for($i=$start; $i<=$end ; $i++){
		if($config['page']==$i){echo "<b>[".($i+1)."]</b> \n";}
		else{echo "<a href=\"$_SERVER[SCRIPT_NAME]?page=$i\" class=page><b>".($i+1)."</b></a> \n";}
	}


	// echo out divide marker
	if(Ceil($end) < $config['totalPages']-1){echo " ... ";}
	else{echo " - ";}

	// echo out NEXT
	if( ($config['page']+1) <= $config['totalPages']-1){
	echo "<a href=\"$_SERVER[SCRIPT_NAME]?page=".($config['page']+1)."\" class=page><b>»»»</b></a> ";}
	// else no link
	else{echo " <b>»»»</b> ";}

echo "</td></tr>";
}#-#end GetPageNumbers()

?>


</td></tr></table>

</body>
</html>
 
bafitu каза:
а папката thumb на 777 ли е ?

huh...плашиш ме с тази снимка...синя група от хора

да, благодаря ти...прав си, стана
интересно че преди въобще не съм задавал тъмб да е на 777, а си работеше

мерси отново
 

Back
Горе