Здравейте,
след като инклудня следният код в индекса
код-а губи деиствието си и нищо неправи
как да го оправя това нещо
Блаодаря предварително
след като инклудня следният код в индекса
код-а губи деиствието си и нищо неправи
Код:
<?php
$template = "";
# Desired width of thumbnails (or 0 for auto)
$thumbw = 0;
# Desired height of thumbnails (or 0 for auto)
$thumbh = 100;
# $perrow = number of thumbnails to display in each row
$perrow = 4;
# really should be some multiple of $perrow
$perpage = 8;
# Size of the border for the table, in pixels
$tableborder = 0;
# Width of the table
$tablewidth = "100%";
# Cell spacing for the table, in pixels
$cellspacing = 3;
# Color of the table
$bgcolor = "#f0f0f0";
# Font to use for displaying the table
$fontface = "Verdana, Arial";
# Font size
$fontsize = 2;
# Display file name
$showname = 0;
# Display image coordinates
$showcoords = 1;
# Display file size in KB
$showsize = 0;
$header = '';
$footer = '';
$linkurl = "%picname%";
set_time_limit(0);
if(!$template){
$template .= <<<EOT
</center><p align="center"><font face="$fontface" size="$fontsize">%output%</font></p>
EOT;
}
else{
$template = implode("", file($template));
}
$jpegs = array();
$directory = opendir(getcwd());
while($filename = readdir($directory)){
if((strlen($filename) > 2) && (strcasecmp(substr($filename, 0, 5), 'thumb') != 0)){
$localext = substr($filename, -3);
if(strcasecmp($localext, 'jpg') != 0)
continue;
else{
array_push($jpegs, $filename);
}
}
}
sort($jpegs);
reset($jpegs);
foreach($jpegs as $var){
if(!file_exists("thumb$var")){
if(!isset($pleasehold)){
$pleasehold = 1;
echo "<font face='$fontface' size='$fontsize'><b>One moment please...</b><br><br>New images were found in this gallery, and thumbnails must be made for them.<br><br>Processing images: ";
flush();
}
echo "<font face='$fontface' size='$fontsize'>$var... </font>";
flush();
makejpegthumb("$var", $thumbw, $thumbh, "thumb$var", 100);
}
}
if($pleasehold){
echo "<font face='$fontface' size='$fontsize'><br><br><b>Thumbnails created!</b></font><br>";
}
$nav = "<center><font face='$fontface' size='$fontsize'>";
$numlinks = (int)ceil(count($jpegs)/$perpage);
$linkstart = 1;
for($i=1; $i<=$numlinks; $i++){
$nav .= "<a href='$_SERVER[PHP_SELF]?start=$linkstart' title='Go to page $i'>Page $i</a> ";
$linkstart += $perpage;
}
$nav .= '</font></center><br>';
$output = "$nav\n";
$picnum = (isset($_GET[start])) ? (($_GET[start] == 0) ? 0 : $_GET[start] - 1) : 0;
$output .= <<<EOT
EOT;
for($i=0; $i<(int)($perpage/$perrow); $i++){
$output .= '<tr>';
for($j=0; $j<$perrow; $j++){
$output .= "<td align='center' valign='middle'>";
if(file_exists($jpegs[$picnum])){
$target = str_replace('%picname%', $jpegs[$picnum], $linkurl);
$output .= "<a href='$target' target='_blank'><img src='thumb$jpegs[$picnum]' border='0' alt='Click to view $jpegs[$picnum]'></a>";
if($showname == 1){
$output .= "<br><font face='$fontface' size='$fontsize'>$jpegs[$picnum]</font>";
}
if($showcoords == 1){
$coords = getimagesize($jpegs[$picnum]);
$output .= "<br><font face='$fontface' size='$fontsize'>$coords[0] x $coords[1]</font>";
}
if($showsize == 1){
$output .= "<br><font face='$fontface' size='$fontsize'>" . sprintf("%.02f", (float)(filesize($jpegs[$picnum]) / 1024)) . 'KB</font>';
}
$output .= "\n";
}
$picnum++;
}
$output .= '</tr>';
}
$output .= "</table><br>$nav\n\n";
$template = str_replace('%output%', $output, $template);
if($header){
include($header);
}
echo $template;
if($footer){
include($footer);
}
function makejpegthumb($infile, $outxcoord, $outycoord, $outfile, $quality){
$insize = getimagesize("$infile");
$inxcoord = $insize[0];
$inycoord = $insize[1];
$inresource = imageCreateFromJPEG("$infile");
if($outxcoord == 0){
$ratio = (float)($outycoord / $inycoord);
$outxcoord = $inxcoord * $ratio;
}
else if($outycoord == 0){
$ratio = (float)($outxcoord / $inxcoord);
$outycoord = $inycoord * $ratio;
}
$outresource = imagecreatetruecolor($outxcoord, $outycoord);
$target_pic = imagecopyresampled($outresource, $inresource, 0, 0, 0, 0, $outxcoord, $outycoord, $inxcoord, $inycoord);
imagejpeg($outresource, "$outfile", $quality);
}
?>
Блаодаря предварително