Archive

Archive for April, 2011

TWG 1.8.5 preview was updated

April 15th, 2011 No comments

Hi,

a couple of nice improvements have been made to 1.8.5.

Please see details here:

http://www.tinywebgallery.com/forum/viewtopic.php?f=14&t=2944

Have fun using TWG,

Michael

Categories: PHP, TinyWebGallery Tags:

TWG 1.8.5 preview fixes the lightbox magnifying glass

April 10th, 2011 No comments

Hi,

when using round corners and the magnifying glass of the lightbox the magnifying glass shows above the image.

This is a style sheet issue which is now fixed in the 1.8.5 preview of the forum.

- Michael

Categories: TinyWebGallery Tags:

Optimized function to read the directory size

April 4th, 2011 No comments

Hi,

I was looking for the best and fastest way to read the size of a directory. I found a lot of pure php functions which are very slow. I also found some optimized ways depending on the OS. I put all of them together where first the OS dependent versions are used and then the php one as backup.

On my local system the windows version was 18 times faster than the php version.

I have tested this on a couple of systems which where all using the optimized version. So feel free to use this methods.

You can download the functions here:
http://www.tinywebgallery.com/dl.php?file=getFoldersize

Below you find the (unfortunately) unformatted code.

Have fun using it ;) ,

Michael


/**
*   Optimized way to the the size of a directoy.
*
*    First the windows or Unix way is tried. If this fails
*    the php internal stuff is used.
*
*    if you select legacy = false only the pure php
*    version is used.
*/
function getFoldersize($path, $legacy = true) {
$size = -1;
if ($legacy) {
if (substr(@php_uname(), 0, 7) == "Windows"){
// we have to make the path absolute !
$path_ab = realpath($path);
$obj = new COM ( 'scripting.filesystemobject' );
if ( is_object ( $obj ) ) {
$ref = $obj->getfolder ( $path_ab );
$size = $ref->size;
$obj = null;
}
} else { // hopefully unix -  du has to be in the path. If it is not you have to adjust the path.
$io = popen ( 'du -sb ' . $path, 'r' );
$usize = trim(fgets ( $io, 4096));
$split = preg_split('/s+/', $usize);
$usize = $split[0];
pclose ( $io );
if (is_numeric($usize)) {
$size = $usize;
}
}
}
// backup if both ways fail. It is ~ 18 times slower (tested on windows) than one of the solutions above.
if ($size == -1) {
$size = foldersize($path);
}
return $size;
}

/**
*  The basic php way to go through all directories and adding the file sizes.
*/
function foldersize($p) {
$size = 0;
$fs = scandir($p);
foreach($fs as $f) {
if (is_dir(rtrim($p, '/') . '/' . $f)) {
if ($f!='.' && $f!='..') {
$size += foldersize(rtrim($p, '/') . '/' . $f);
}
} else {
$size += filesize(rtrim($p, '/') . '/' . $f);
}
}
return $size;
}

The 1.8.5 preview does now support canonical URLs

April 3rd, 2011 No comments

Hi,

The 1.8.5 preview does now support canonical URLs.

This means that there is an additional attribute in the header that tells search engines that e.g.

http://www.tinywebgallery.com/demo/index.php?twg_album=01_Administration&twg_show=Administration+Help+Screen.gif

and

http://www.tinywebgallery.com/demo/index.php?twg_album=01_Administration&twg_show=Administration+Help+Screen.gif&twg_rot=90&twg_zs=1301827018

are the same page!

This is important to avoid duplicate content on your site. I have this now running at the demo and will check in the webmaster tools of google how this works :) .

More info about this: http://www.google.com/support/webmasters/bin/answer.py?hl=en&answer=139066

Have fun using TWG,

Michael

Categories: TinyWebGallery Tags:

TWG 1.8.5 preview is in the forum!

April 2nd, 2011 No comments

Hi,

I have already started with TWG 1.8.5 and one of the main features is that folder.txt and foldername.txt can be edited in the front end.
I have implemented this already and the reason why this is available is that new translations are needed as well.
Additionally some small fixes are included.
So if you can help with the translation or want to use this new feature you can already use 1.8.5. But be aware that in the final a lot of more stuff will come.

For details and the download please go here:

http://www.tinywebgallery.com/forum/viewtopic.php?f=14&t=2944&start=0

Have fun using TWG,

Michael

Categories: TinyWebGallery Tags:

Website was refactored

April 2nd, 2011 No comments

Hi,

The website was refactored. It still looks the same but I removed most of the duplicate content.

I had english content under the /de part as well.

So if you have any bookmarks this are not working anymore please update them.

Best,

Michael

Categories: TinyWebGallery Tags: