Archived
1
0
Fork 0

Compare commits

..

No commits in common. "master" and "release-0-2" have entirely different histories.

16 changed files with 90 additions and 219 deletions

View file

@ -1,26 +0,0 @@
OBJECTS = *.php includes/*.php themes/*/*.php dummy/*.php
LANGUAGES = de
TARGETFILES = $(foreach lang,$(LANGUAGES),locale/$(lang)/LC_MESSAGES/sjqg.mo)
POFILES =
all: $(TARGETFILES) $(POFILES)
%.mo: %.po
msgfmt $< -o $@
%.po: locale/sjqg.pot
if [ ! -d `dirname "$@"` ]; then mkdir -p `dirname "$@"`; fi
if [ -f $@ ]; then \
msgmerge -U $@ $<; \
else \
cp $< $@; \
fi
locale/sjqg.pot: $(OBJECTS)
xgettext -d sjqg -o sjqg.pot -p locale \
--from-code=UTF8 --sort-output \
--copyright-holder='Jan Dittberner <jan@dittberner.info>' \
--package-name='SJQG' --package-version='0.3' \
--language=PHP $(OBJECTS)
.SECONDARY:

View file

@ -1,6 +1,5 @@
[gallery]
title = Beispielbilder
weight = 2
[images]
cimg3033_Small.jpg = Kerze

Binary file not shown.

Before

Width:  |  Height:  |  Size: 130 KiB

View file

@ -1,6 +1,5 @@
[gallery]
title = Beispielbilder 2
weight = 1
[images]
dsc_4511.jpg = Blume
@ -9,4 +8,3 @@ dsc_4876.jpg = Blumen
dsc_4923.jpg = Schwalbe
dsc_3800.jpg = Katze
dsc_4925.jpg = Landschaft
dsc_2612.jpg = Kreuz

View file

@ -32,15 +32,11 @@ define(IMAGESEC, "images");
define(GALLERYSEC, "gallery");
define(GALLERY_RE, '/^[\w\d _-]+$/');
define(SCALE_WIDTH, 0);
define(SCALE_HEIGHT, 1);
define(SCALE_BOTH, 2);
$basedir = realpath(implode(DIRECTORY_SEPARATOR, array(dirname(__file__), '..')));
$inifile = implode(DIRECTORY_SEPARATOR, array($basedir, 'gallery.ini'));
if (!file_exists($inifile)) {
die(sprintf(_("required %s not found."), $inifile));
die("required $inifile not found.");
}
$configuration = parse_ini_file($inifile);
if (array_key_exists('logfile', $configuration)) {
@ -122,14 +118,11 @@ function getImageInfo($galleryname, $imagename) {
$label = getImageLabel($galleryname, $imagename);
$gallerylabel = getGalleryLabel($galleryname);
$scaledimage = getScaledImage($galleryname, $imagename,
$theme->previewsize, SCALE_BOTH);
$scaledsize = getimagesize($configuration['gallerydir'] .
DIRECTORY_SEPARATOR . $scaledimage);
return array("name" => $imagename,
"label" => $label,
"preview" => array($configuration['gallerypath'] . '/' .
$scaledimage, $scaledsize[0], $scaledsize[1]),
"preview" => $configuration['gallerypath'] . '/' .
getScaledImage($galleryname, $imagename,
$theme->previewsize, false),
"full" => implode('/', array($configuration['gallerypath'],
$galleryname, $imagename)),
"title" => sprintf("%s :: %s", $gallerylabel, $label)
@ -187,33 +180,6 @@ function getGalleryLabel($galleryname) {
return $label;
}
function cmpGalleryByWeight($a, $b) {
if (($a[0] == $b[0]) && (strcmp($a[1], $b[1]) == 0)) {
return 0;
}
if ($a[0] == $b[0]) {
return strcmp($a[1], $b[1]);
}
return ($a[0] < $b[0]) ? -1 : 1;
}
function getOrderedGalleries() {
global $configuration;
$galleries = array();
foreach (glob(realpath($configuration['gallerydir']) . DIRECTORY_SEPARATOR . '*', GLOB_ONLYDIR) as $directory) {
$basename = basename($directory);
if (galleryExists($basename)) {
$inidata = getGalleryConfig($basename);
$weight = (array_key_exists('weight', $inidata[GALLERYSEC])) ?
intval($inidata[GALLERYSEC]['weight']) : 0;
$galleries[] = array($weight, $basename);
}
}
usort($galleries, 'cmpGalleryByWeight');
return $galleries;
}
/**
* Liefert die aktuelle Galerie. Die Galerie kann entweder im
* GET-Parameter @c galleryname stehen, als Wert @a default in der
@ -230,8 +196,20 @@ function getCurrentGallery() {
galleryExists($_GET["galleryname"])) {
return $_GET["galleryname"];
}
$galleries = getOrderedGalleries();
return (count($galleries) > 0) ? $galleries[0][1] : null;
$filepath = realpath($configuration['gallerydir'] . DIRECTORY_SEPARATOR . 'galleryinfo.ini');
if (!empty($filepath)) {
$inidata = getGalleryConfig();
if (galleryExists($inidata[GALLERYSEC]["default"])) {
return $inidata[GALLERYSEC]["default"];
}
}
foreach (glob(realpath($configuration['gallerydir']) . DIRECTORY_SEPARATOR . '*', GLOB_ONLYDIR) as $directory) {
$basename = basename($directory);
if (galleryExists($basename)) {
return $basename;
}
}
return null;
}
/**
@ -251,52 +229,35 @@ function getCurrentGallery() {
*
* @return Pfad des skalierten Bildes relativ zu @a gallerydir
*/
function getScaledImage($galleryname, $basename, $maxdim, $scaletype) {
function getScaledImage($galleryname, $basename, $maxdim, $scaleheight=true) {
global $configuration;
if ($maxdim == 0) {
debug_print_backtrace();
}
$gallerydir = realpath($configuration['gallerydir'] . DIRECTORY_SEPARATOR . $galleryname);
$originalfile = $gallerydir . DIRECTORY_SEPARATOR . $basename;
switch($scaletype) {
case SCALE_WIDTH:
$scaleheight = false;
break;
case SCALE_HEIGHT:
$scaleheight = true;
break;
case SCALE_BOTH:
$originalsize = getimagesize($originalfile);
$scaleheight = ($originalsize[1] > $originalsize[0]);
break;
default:
header('Content-Type: text/plain');
debug_print_backtrace();
die(_('Unknown scale type'));
}
if ($scaleheight) {
$scaleddir = sprintf("scaled_x%d", $maxdim);
$scaleddir = sprintf("%s%sscaled_x%d", $galleryname,
DIRECTORY_SEPARATOR, $maxdim);
} else {
$scaleddir = sprintf("scaled%dx_", $maxdim);
$scaleddir = sprintf("%s%sscaled%dx_", $galleryname,
DIRECTORY_SEPARATOR, $maxdim);
}
$scaleddirpath = implode(DIRECTORY_SEPARATOR,
array($configuration['gallerydir'], $galleryname, $scaleddir));
$scaleddirpath = $configuration['gallerydir'] . DIRECTORY_SEPARATOR . $scaleddir;
if (!is_dir($scaleddirpath)) {
// versuchen das Thumbnail-Verzeichnis anzulegen
$mkdir = @mkdir($scaleddirpath, 0755);
if (!$mkdir) {
trigger_error(sprintf(_("could not create directory %s.\n"),
$scaleddirpath),
trigger_error("could not create directory $scaleddirpath.\n",
E_USER_WARNING);
return $galleryname . '/' . $basename;
return $galleryname . DIRECTORY_SEPARATOR . $basename;
}
}
$scaledimage = $scaleddirpath . DIRECTORY_SEPARATOR . $basename;
if (!is_file($scaledimage)) {
// Datei erzeugen
$originalfile = $gallerydir . DIRECTORY_SEPARATOR . $basename;
$origimage = imagecreatefromjpeg($originalfile);
$origx = imagesx($origimage);
$origy = imagesy($origimage);
@ -314,7 +275,7 @@ function getScaledImage($galleryname, $basename, $maxdim, $scaletype) {
$origx, $origy);
imagejpeg($newimage, $scaledimage, 90);
}
return implode('/', array($galleryname, $scaleddir, $basename));
return $scaleddir . DIRECTORY_SEPARATOR . $basename;
}
/**
@ -333,13 +294,17 @@ function getThumbNailInfo($galleryname) {
$thumbsizes = array();
$thumbdimsum = 2;
$scaletype = ($theme->themetype == 'horizontal') ? SCALE_HEIGHT : SCALE_WIDTH;
foreach (glob(realpath($configuration['gallerydir'] . DIRECTORY_SEPARATOR .
$galleryname) . DIRECTORY_SEPARATOR .
'*.jp{e,}g', GLOB_BRACE) as $filename) {
$basename = basename($filename);
$thumbfile = getScaledImage($galleryname, $basename, $theme->thumbsize,
$scaletype);
if ($theme->themetype == 'horizontal') {
$thumbfile = getScaledImage($galleryname, $basename, $theme->thumbsize,
true);
} else {
$thumbfile = getScaledImage($galleryname, $basename, $theme->thumbsize,
false);
}
if ($thumbsize = getimagesize(realpath($configuration['gallerydir'] .
DIRECTORY_SEPARATOR .
$thumbfile))) {
@ -370,22 +335,25 @@ function getGalleryLinks() {
global $configuration;
$retval = array();
$galleries = getOrderedGalleries();
foreach ($galleries as $gallery) {
$urlparams = array();
$urlparams['galleryname'] = $gallery[1];
if (array_key_exists('theme', $_GET)) {
$urlparams['theme'] = $_GET['theme'];
foreach (glob(realpath($configuration['gallerydir']) . DIRECTORY_SEPARATOR . '*',
GLOB_ONLYDIR) as $directory) {
$basename = basename($directory);
if (galleryExists($basename)) {
$urlparams = array();
$urlparams['galleryname'] = $basename;
if (array_key_exists('theme', $_GET)) {
$urlparams['theme'] = $_GET['theme'];
}
$parts = array();
foreach ($urlparams as $key => $value) {
$parts[] = sprintf("%s=%s", $key, urlencode($value));
}
$url = sprintf('index.php?%s',
implode(ini_get('arg_separator.output'), $parts));
$retval[] = array('gallery' => $basename,
'label' => getGalleryLabel($basename),
'url' => htmlspecialchars($url));
}
$parts = array();
foreach ($urlparams as $key => $value) {
$parts[] = sprintf("%s=%s", $key, urlencode($value));
}
$url = sprintf('index.php?%s',
implode(ini_get('arg_separator.output'), $parts));
$retval[] = array('gallery' => $gallery[1],
'label' => getGalleryLabel($gallery[1]),
'url' => htmlspecialchars($url));
}
return $retval;
}
@ -409,7 +377,7 @@ function getAllThumbnails(&$thumbinfo) {
$retval = array();
foreach ($thumbinfo[2] as $basename => $data) {
$retval[] = array('src' => $configuration['gallerypath'] . '/' . $data[0],
$retval[] = array('src' => $configuration['gallerydir'] . DIRECTORY_SEPARATOR . $data[0],
'sizes' => $data[1][3],
'alt' => getImageLabel($thumbinfo[1], $basename));
}
@ -437,16 +405,17 @@ function getFirstPreview(&$thumbinfo) {
$basename = key($thumbinfo[2]);
$data = current($thumbinfo[2]);
$galleryname = $thumbinfo[1];
$fullname = $configuration['gallerypath'] . '/' . $galleryname . '/' . $basename;
$fullname = $configuration['gallerypath'] . DIRECTORY_SEPARATOR . $galleryname .
DIRECTORY_SEPARATOR . $basename;
$scaledimage = getScaledImage($galleryname, $basename,
$theme->previewsize, SCALE_BOTH);
$theme->previewsize, false);
$scaledimagesize = getimagesize(realpath($configuration['gallerydir'] .
DIRECTORY_SEPARATOR .
$scaledimage));
$label = getImageLabel($galleryname, $basename);
return array('title' => $label,
'full' => $fullname,
'src' => $configuration['gallerypath'] . '/' . $scaledimage,
'src' => $configuration['gallerypath'] . DIRECTORY_SEPARATOR . $scaledimage,
'alt' => $label,
'sizes' => $scaledimagesize[3]);
}

View file

@ -28,8 +28,7 @@
* <http://www.gnu.org/licenses/>.
*/
$dir = dirname(realpath(__file__));
require("$dir" . DIRECTORY_SEPARATOR . "template.class.php");
require('includes/template.class.php');
/**
* Theme class.
@ -67,7 +66,7 @@ class Theme {
*/
function __construct($name, &$configuration) {
$themeini = realpath(implode(DIRECTORY_SEPARATOR,
array($configuration['themedir'], $name, 'theme.ini')));
array('themes', $name, 'theme.ini')));
if (!$themeini) {
die("invalid theme $name");
}

View file

@ -32,7 +32,7 @@
* <http://www.gnu.org/licenses/>.
*/
$basedir = realpath(dirname(__file__));
$basedir = dirname(__file__);
/**
* Inkludiert die Funktionsbibliothek.
@ -59,17 +59,16 @@ $template = $theme->getTemplate();
if ($theme->themetype == 'horizontal') {
$inlinestyles = sprintf("#scrollable { width:%dpx; }\n", $thumbinfo[0]);
$inlinescript = array("var themetype='horizontal';");
$inlinescript = "var themetype='horizontal';";
} else {
$inlinestyles = sprintf("#scrollable { height:%dpx; }\n", $thumbinfo[0]);
$inlinescript = array("var themetype='vertical';");
$inlinescript = "var themetype='vertical';";
}
$inlinescript[] = "var basepath='" . $configuration['basepath'] . "';";
$template->assign('scripts', $scripts);
$template->assign('styles', $styles);
$template->assign('inlinestyle', $inlinestyles);
$template->assign('inlinescript', implode("\n", $inlinescript));
$template->assign('inlinescript', $inlinescript);
$template->assign('title', getGalleryTitle($thumbinfo));
$template->assign('gallerylinks', getGalleryLinks());
$template->assign('thumbnails', getAllThumbnails($thumbinfo));

Binary file not shown.

View file

@ -1,30 +0,0 @@
# German translation for SJQG
# Copyright (C) 2009 Jan Dittberner <jan@dittberner.info>
# This file is distributed under the same license as the
# scrollingJqueryGallery package.
# Jan Dittberner <jan@dittberner.info>, 2009.
#
msgid ""
msgstr ""
"Project-Id-Version: SJQG 0.3\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-07-31 23:11+0200\n"
"PO-Revision-Date: 2009-07-31 23:11+0200\n"
"Last-Translator: Jan Dittberner <jan@dittberner.info>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: includes/galleryfunctions.php:276
msgid "Unknown scale type"
msgstr "Unbekannter Skalierungstyp"
#: includes/galleryfunctions.php:290
#, php-format
msgid "could not create directory %s.\n"
msgstr "Konnte Verzeichnis %s nicht anlegen.\n"
#: includes/galleryfunctions.php:43
#, php-format
msgid "required %s not found."
msgstr "benötigte %s nicht gefunden."

View file

@ -1,31 +0,0 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR Jan Dittberner <jan@dittberner.info>
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: SJQG 0.3\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-07-31 23:11+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: includes/galleryfunctions.php:276
msgid "Unknown scale type"
msgstr ""
#: includes/galleryfunctions.php:290
#, php-format
msgid "could not create directory %s.\n"
msgstr ""
#: includes/galleryfunctions.php:43
#, php-format
msgid "required %s not found."
msgstr ""

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

View file

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 14.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 43363) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Ebene_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="20px" height="20px" viewBox="0 0 20 20" enable-background="new 0 0 20 20" xml:space="preserve">
<rect fill="#921422" width="20" height="20"/>
<path fill="#FFFFFF" d="M12.101,9.172l-4.824,3.4l3.628,4.277l0.252-2.347c10.443-0.187,9.117-11.23-0.395-9.89
C1.827,5.506-2.441,15.297,8.595,14.728L6.899,12.83c-4.02,0.615-3.919-6.143,4.244-7.472c8.035-0.675,4.352,7.276,0.336,7.111
L12.101,9.172z"/>
</svg>

Before

Width:  |  Height:  |  Size: 783 B

View file

@ -51,15 +51,17 @@ function getPathParts(imagesrc) {
}
function updateContentImage(pathParts) {
$.get(basepath + "ajaxrequest.php", {
$.getJSON("ajaxrequest.php", {
"imagename" : pathParts.filename,
"galleryname" : pathParts.gallery
}, function(data, textStatus) {
$("#imagedescription").text(data["label"]);
$('#content_main img').attr('alt', data.label).attr('src', data.preview[0]).attr('width', data.preview[1]).attr('height', data.preview[2]);
$("#content_main a").attr("href", data["full"]).attr("title", data["label"]);
$("#content_main img").attr("alt", data["label"]);
$("#content_main img").attr("src", data["preview"]);
$("#content_main a").attr("href", data["full"]);
$("#content_main a").attr("title", data["label"]);
document.title = data["title"];
}, 'json');
});
}
$(document).ready(function() {

View file

@ -1,4 +1,4 @@
git sta/*
/*
* Copyright (c) 2008 Jan Dittberner <jan@dittberner.info>
* Jan Dittberner IT-Consulting & -Solutions
* Cottbuser Str. 1, D-01129 Dresden
@ -66,8 +66,9 @@ a.lightbox img {
}
#imagedescription {
position:relative;
weight: 330px;
height: 25px;
top: 330px;
top: 300px;
left: 0px;
color: #ffffff;
font-size:10px;
@ -75,6 +76,7 @@ position:relative;
font-weight:normal;
text-align:center;
vertical-align:center;
}
.imgdescription {
color: #ffffff;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2009 Jan Dittberner <jan@dittberner.info>
* Copyright (c) 2008 Jan Dittberner <jan@dittberner.info>
* Jan Dittberner IT-Consulting & -Solutions
* Cottbuser Str. 1, D-01129 Dresden
*
@ -203,7 +203,7 @@ a:active {
#content_sub {
position:absolute;
width:330px;
height:350px;
height:330px;
left: 143px;
top: 149px;
}
@ -213,7 +213,7 @@ a:active {
width:20px;
height:10px;
left: 298px;
top: 330px;
top: 305.5px;
z-index:1;
}
@ -221,8 +221,8 @@ a:active {
position:absolute;
width:311px;
height:311px;
top: 9px;
left: 9px;
top: 9.5px;
left: 9.5px;
text-align:center;
font-weight: normal;
}