Skip to content

Commit

Permalink
Initial version by Thorben Kröger
Browse files Browse the repository at this point in the history
  • Loading branch information
lbovet committed Apr 5, 2011
0 parents commit 262ab30
Show file tree
Hide file tree
Showing 19 changed files with 1,705 additions and 0 deletions.
47 changes: 47 additions & 0 deletions README
@@ -0,0 +1,47 @@
Installation
============

Prerequisites
-------------
You need a working apache webserver with PHP 5 installed.

Make sure PHP's safe_mode is disabled and your webserver has write
permission in the photos/ directory, otherwise PHP won't be able to
write files, and you'll have to do that manually.

PHP 4 will not work, as it cannot open SQLite databases (digikam saves
it's database in SQLite format) and it's Object-Syntax is different.
Feel free to adapt this script to PHP 4 though, should be easy, the
digikam database could be dumped into a mysql database.

Installation
------------
Put the unpacked archive somewhere in your htdocs or public_html folder
so apache can find it

Example: /home/thorben/public_html/photos/{files}

Then open this in your webbrowser:
http://localhost/~thorben/photos/albumview/setup

Follow the instructions :-)

Go to
http://localhost/~thorben/photos/albumview

Done.

Troubleshooting
---------------
Nothing yet

About
=====
This script was written to let others browse my photos and making use of
digikam's great tagging feature, which the ordinary HTML export didn't
offer.

It's very easy to use wget to get the functionality of the export plugin.

It works for me, but I realize this is neither very elegant nor very fast.
Feel free to improve it :-)
36 changes: 36 additions & 0 deletions albumview.php
@@ -0,0 +1,36 @@
<?php
/*
Author: Thorben Kröger <thorbenk@gmx.net>
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, 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.
*/

/**
* Main file.
* Everything is handled in class Photoalbum.
*/

if(!file_exists('inc/config.inc.php') && !strstr($_SERVER['REQUEST_URI'], 'setup')) {
$scriptname = substr(strrchr($_SERVER['SCRIPT_NAME'], '/'),1);
$url = substr($_SERVER['SCRIPT_NAME'], 0, strrpos($_SERVER['SCRIPT_NAME'], '/'));
header("Location: $url/$scriptname/setup");
exit;
}

header('Content-Type: text/html; charset=utf-8');
error_reporting(E_ALL | E_STRICT);
date_default_timezone_set('UTC');

require_once('inc/photoalbum.inc.php');
$album = new Photoalbum();

?>
Binary file added icons/arrow.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/gohome.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions inc/config.inc.php
@@ -0,0 +1,28 @@
<?php
// C O N F I G / / / / / / / / / / / /

//Language
require_once('lang/en.lang.php');

//Albums to show
$_config['restrictedAlbums'] = "Albums.id IN (1,2,3,4,5,6,7)";
//Paths
$_config['digikamDb'] = "/home/shaman/photokam/out2/digikam3.db";
$_config['photosPath'] = "/home/shaman/photokam/out2";
$_config['convertBin'] = "/usr/bin/convert";
$_config['exifBin'] = "/usr/bin/exif";
//Image and thumbnail sizes
$_config['thumbSize'] = "240";
$_config['imageSize'] = "720";
//Layout
$_config['numCols'] = "3";
$_config['photosPerPage'] = "12";
// / / / / / / / / / / / / / / / / / /

//These should be automatically correct
$_config['selfDir']=substr($_SERVER['SCRIPT_FILENAME'], 0,
strrpos($_SERVER['SCRIPT_FILENAME'], '/'));
$_config['selfUrl']=substr($_SERVER['SCRIPT_NAME'], 0,
strrpos($_SERVER['SCRIPT_NAME'], '/'));
$_config['scriptname']=substr(strrchr($_SERVER['SCRIPT_NAME'], '/'),1);
?>
3 changes: 3 additions & 0 deletions inc/footer.inc.html
@@ -0,0 +1,3 @@

</body>
</html>
20 changes: 20 additions & 0 deletions inc/header.inc.html
@@ -0,0 +1,20 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title><?php echo $i18n['photos']; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type='text/css'>
body { color: #ffffff; background: #000000;
font-family: Arial, sans-serif;
font-size: 12pt; margin: 15pt;
}
h1 { color: #ffffff;}
table { text-align: center; margin-left: auto; margin-right: auto;}
td { color: #ffffff; padding: 1em}
img { border: 1px solid #000000; }
a:link { color: #808080; }
a:visited { color: #808080; }
</style>
</head>
<body>

41 changes: 41 additions & 0 deletions inc/imagespagedata.inc.php
@@ -0,0 +1,41 @@
<?php
/*
Author: Thorben Kröger <thorbenk@gmx.net>
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, 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.
*/

/**
* This data structure holds the data for one displayed page of photos
* For this, it has $_imagesArray, an associative array gotten from the
* sqlite query and $_count, the total number of photos for the query,
* which is later used to calculate the number of pages etc.
*/
class ImagesPageData {
function __construct($imagesArray, $count) {
$this->_count = $count;
$this->_imagesArray = $imagesArray;
}

public function count() {
return $this->_count;
}

public function imagesArray() {
return $this->_imagesArray;
}

private $_count;
private $_imagesArray;
}

?>
39 changes: 39 additions & 0 deletions inc/informativepdo.inc.php
@@ -0,0 +1,39 @@
<?php
/*
Author: Thorben Kröger <thorbenk@gmx.net>
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, 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.
*/

/**
* Class that wraps around PHP's PDO class to count the number of queries
* to the database that where executed.
*/
class InformativePDO extends PDO {
function __construct($dataSourceName) {
PDO::__construct($dataSourceName);
$this->_count=0;
}

public function query($sql) {
$this->_count++;
return PDO::query($sql);
}

public function queryCount() {
return $this->_count;
}

private $_count;
};

?>
22 changes: 22 additions & 0 deletions inc/languages.inc.php
@@ -0,0 +1,22 @@
<?php
/*
Author: Thorben Kröger <thorbenk@gmx.net>
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, 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.
*/

$languages = array(
'en' => 'English',
'de' => 'Deutsch'
);

?>

0 comments on commit 262ab30

Please sign in to comment.