![Antiguo](http://static.forosdelweb.com/fdwtheme/images/statusicon/post_old.gif)
17/07/2006, 19:42
|
![Avatar de El_MiMo](http://static.forosdelweb.com/customavatars/avatar40775_2.gif) | | | Fecha de Ingreso: septiembre-2003 Ubicación: Chile
Mensajes: 123
Antigüedad: 21 años, 5 meses Puntos: 1 | |
galeria Estimado, mira www.autodromopacificosport.cl/?modulo=fotos.php
Este código toma las fotos de un directorio y general los th y la galería.
Código:
<?php // charset=ISO-8859-1
/*
* galerie.php - a simple gallery script
* Copyright (C) 2002, 2003 Daniel Wacker <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* --
* This script provides a simple gallery of all images that are located
* in the script's directory and subdirectories.
*
* Requirements
* - PHP >= 4.1.0
* - GD Library ( >= 2.0.1 for good thumbnails)
* - JPEG software
* - PHP >= 4.3.0 or GD < 1.6 for GIF support
* - libpng for PNG support
*
* Installation
* Simply put this script in a folder of your web server and call it in a
* web browser. Be sure that the script has permission to read the image
* files and to create and write into the thumbnail folder.
*
* Attention:
* This script tries to generate jpeg thumbnail files in a subfolder of the
* gallery folder(s). The filenames look like "originalfilename.thumb.jpg".
*
/* ------------------------------------------------------------------------- */
/* Select your language:
* 'en' - English
* 'de' - German
*/
$lang = 'en';
/* Select your charset
*/
$charset = 'ISO-8859-1';
/* How many images per page?
*/
$maxpics = 28;
/* Create thumbnails in this subfolder
*/
$thumbdir = 'thumbs';
/* Size of created thumbnails
*/
$thumbsize = 120;
/* Wether to show file names (true or false)
*/
$filenames = false;
/* Wether to show subdirectores (true or false)
*/
$subdirs = true;
/* Wether to show a title (true or false)
*/
$title = true;
/* Set the gallery root relative to the script's directory.
*
* If you include() this script, set the path relative to
* the directory of the script, that does the include().
*/
$picdir = '.';
/* Set this to true if you include() this script.
*/
$included = false;
/* Set this to true, if you include() this script and want the images
* to be shown inline.
*/
$inline = true;
/* Set the thumbnail background color, if you include() this script.
*/
$bg = 'FFFFFF';
/* ------------------------------------------------------------------------- */
switch ($lang) {
case 'de':
$words = array(
'gallery' => 'Galerie',
'src' => 'Quelltext',
'error' => 'Fehler',
'php_error' => 'PHP Version 4.1 oder höher ist erforderlich.',
'gd_error' => 'Die GD-Bibliothek wird benötigt. Siehe http://www.boutell.com/gd/.',
'jpg_error' => 'Die JPEG-Bibliothek wird benötigt. Siehe ftp://ftp.uu.net/graphics/jpeg/.',
'mkdir_error' => 'Schreibrecht im Verzeichnis ist erforderlich.',
'opendir_error' => 'Das Verzeichnis "%1" kann nicht gelesen werden.'
);
break;
case 'en':
default:
$words = array(
'gallery' => 'gallery',
'src' => 'source code',
'error' => 'Error',
'php_error' => 'PHP >= 4.1 is required.',
'gd_error' => 'GD Library is required. See http://www.boutell.com/gd/.',
'jpg_error' => 'JPEG software is required. See ftp://ftp.uu.net/graphics/jpeg/.',
'mkdir_error' => 'Write permission is required in this folder.',
'opendir_error' => 'The directory "%1" can not be read.'
);
}
isset($_SERVER) || $error = error('php', array());
function_exists('imagecreate') || $error = error('gd', array());
function_exists('imagejpeg') || $error = error('jpg', array());
@ini_set('memory_limit', -1);
$jpg = '\.jpg$|\.jpeg$'; $gif = '\.gif$'; $png = '\.png$';
$fontsize = 2;
if (array_key_exists('src', $_REQUEST)) {
ob_start();
highlight_file(basename($_SERVER['PHP_SELF']));
$src = ereg_replace('<font color="([^"]*)">', '<span style="color: \1">', ob_get_contents());
$src = ereg_replace('</font>', '</span>', $src);
ob_end_clean();
}
function w ($w) {
global $words;
return h($words[$w]);
}
function h ($w) {
global $charset;
return htmlentities($w, ENT_COMPAT, $charset);
}
function error ($w, $a) {
return str_replace(array('%1'), $a, w($w .'_error'));
}
if (!$included) {
echo('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
body { font-family: sans-serif }
hr { border-style: none; height: 1px; background-color: silver; color: silver }
p { margin: 0px; padding: 0px }
#pagenumbers { text-align: center; margin: 0px 1em 0px 1em }
img { margin: 10px; border: none }
a { text-decoration: none }
#src');
__________________ aaa!! |