Php photo gallery TWG | JFUploader | TWG Flash upload | WFU | Forum
https://www.tinywebgallery.com/forum/

More random trouble
https://www.tinywebgallery.com/forum/viewtopic.php?f=1&t=528
Page 1 of 2

Author:  palmen [ 21. Sep 2006, 21:16 ]
Post subject:  More random trouble

Two things:

First:
Click on random goes to gallery main page and not showing the random image. The link looks the same as the example on this site. But that link brings me right to the random image.

Second:
I have set up the gallery so other people can add their own pictures to the gallery (thats soo powerful) but those images do not turn up among the randomized images on the main page.

The site is http://www.falufotoklubb.se

I have uploaded all galleries by ftp except the folder "Peter Jaktlund". That folder has been populated by the admin pages and the flash uploader. I have cleared the cache and reloaded the main page/random image (like 40 times) but the pictures from folder "Peter Jaktlund" do NOT show up....

Could the be a permission issue?

Author:  TinyWebGallery [ 21. Sep 2006, 22:07 ]
Post subject: 

Hi,

You have enabled the session cache of TWG. When you upload pictures they are shown the next time you get a new session.

I just checked your site - 7 images in the folder you uploaded by twg uploader.

the random image is the thing I don't understand. can you please check the counter/_mydebug.out if is exists?
Normally all erors are shown there.

/Michael

Author:  palmen [ 22. Sep 2006, 18:35 ]
Post subject: 

I dont understand your answere, could you please clarify which question you are answering.

I have reloaded the first page with the randomized pic but te new pics never show up. Restarted browser and even tested on other computers.

The log file looks like this, its a bit bigger but that just more occurances fo thse entries :

09.20.2006 23:06:00 - 'pictures/Peter Jaktlund/Cliff in Clouds.jpg' does not exist

09.21.2006 7:37:37 - st:false

09.21.2006 7:38:00 - st:true

09.21.2006 7:45:45 - 'pictures/Peter Jaktlund/test_bild.jpg' does not exist

09.21.2006 7:46:14 - st:false

09.21.2006 8:12:18 - st:false

Author:  TinyWebGallery [ 22. Sep 2006, 19:00 ]
Post subject: 

the st are only debug - they can be ignored.
open inc/ajaxserver.inc.php and look for the debug where the st is printed - simply remove it.

and the other ones that images are not found - this normally happends when an url is changed manually

the first part was for question one

You have enabled the session cache of TWG. When you upload pictures they are shown the next time you get a new session.

I just checked your site - 7 images in the folder you uploaded by twg uploader.

- the second for question 2

seems like the image don't exist anymore - and I cannot set them - therfore maybe an old link.

The random does not work because you use an iframefor the gallery - but you call gallerie.php with the parameter - this is fine - but you have to give this parameter to the index.php of TWG - simply parse this parameter and add it to the call of the gallery

Author:  palmen [ 23. Sep 2006, 20:01 ]
Post subject: 

Thanx now all is solved.

Further I wonder:

In the random link it would be nice to have an option to include all images/dir s without having to change the link for each new folder added.

I will create the link dynamic by enumerate all folders. That will work fine with a few lines of code. But what about sub dirs ? Is it possible and if so what is the format in the link?

Like this ?
twg_album=TopFolder|SubFolder

Or like this?
twg_album=TopFolder|TopFolder/SubFolder

Author:  TinyWebGallery [ 24. Sep 2006, 13:54 ]
Post subject: 

the 2nd one.

Use the format yo see at the paramerter twg_album in the url.

Using subdfirs is on my dodo list for 1.6. It´s not that easy because passwordprotected folders have to be treated right as well.

/Michael

Author:  palmen [ 27. Sep 2006, 08:05 ]
Post subject: 

I have written code to dynamically build the code for viewing a random image. The problem is that sometimes no picture is displayed.

The URL generated loooks ok to me and the only diffrence to the hand coded one I used previously is that there are some empty folders included. Can that be the problem?

Must all folders specified in the Random URL contain images? I could guess that first a folder is picked by random and then a picture.

The PHP code for building the URL (free to use for anyone...):

<img src="galleri/image.php?twg_album=<?php
$dir_handle = @opendir("./galleri/pictures") or die("Unable to open $path");
// Loop through the folders
$folders = "";
while ($file = readdir($dir_handle))
{
if($file == "." || $file == ".." || $file == "index.php" )
continue;
$folders .= urlencode($file) . "|";
}
// Close
closedir($dir_handle);
$folders = rtrim($folders,"|");
echo $folders;
?>&twg_random=1&twg_type=random&twg_random_size=200" border="0">

Author:  TinyWebGallery [ 27. Sep 2006, 09:26 ]
Post subject: 

yes - first the folder is picked then the image -

you have to exclude empty folders in your random code

/Michael

Author:  palmen [ 28. Sep 2006, 10:48 ]
Post subject: 

this is my result if anyone is intrested:

<img src="galleri/image.php?twg_album=<?php
function containsJpeg($dir)
{
$retval = false;
if (is_dir($dir))
{
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false)
{
if($file != "." && $file != "..")
{
//if(endswith )
if(ereg("jpg$", $file))
{
$retval = true;
break;
}
}
}
closedir($dh);
}
}
return $retval;
}

$galleryBasePath = "./galleri/pictures/";
$dir_handle = @opendir($galleryBasePath) or die("Unable to open $path");
$folders = "";
while ($file = readdir($dir_handle))
{
$isdir = is_dir($galleryBasePath . $file);
if($file != "." && $file != ".." && $file != "index.php" )
{
if($isdir)
{
if(containsJpeg($galleryBasePath . $file))
{
$folders .= urlencode($file) . "|";
}
}
}
}

closedir($dir_handle);
$folders = rtrim($folders,"|");
echo $folders;
?>&twg_random=1&twg_type=random&twg_random_size=200" border="0">

Author:  Steffo74 [ 19. Dec 2006, 01:05 ]
Post subject: 

Hello!

Great script! BUT, always a but ;) I only get a random picture from the first picture folder that I created for a long time ago. The script dont seem to grab pictures from other folders. But when checking the "code" the folders are there.

Any one knows why this happens?

Regards from the kindom of Sweden.

Author:  TinyWebGallery [ 22. Dec 2006, 16:33 ]
Post subject: 

which code have you used to included?

You can try the 1.6 beta too - is does recusively go through all folders if you like - see the howto in the download.

/Michael

Author:  Steffo74 [ 2. Jan 2007, 12:21 ]
Post subject: 

1. Happy New Year Michael!

2. Testpage for this task is this. #removed_broken_link

Thanks for your reply, used the code as above and used also your default soultion as : <img src="../foto/twg/image.php?twg_album=2006/Rock%20City+HLR&twg_random=1&twg_type=random&twg_random_size=200">



<img src="../foto/twg/image.php?twg_album=2006/<?php
function containsJpeg($dir)
{
$retval = false;
if (is_dir($dir))
{
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false)
{
if($file != "." && $file != "..")
{
//if(endswith )
if(ereg("jpg$", $file))
{
$retval = true;
break;
}
}
}
closedir($dh);
}
}
return $retval;
}

$galleryBasePath = "../foto/twg/pictures/2006/";
$dir_handle = @opendir($galleryBasePath) or die("Unable to open $path");
$folders = "";
while ($file = readdir($dir_handle))
{
$isdir = is_dir($galleryBasePath . $file);
if($file != "." && $file != ".." && $file != "index.php" )
{
if($isdir)
{
if(containsJpeg($galleryBasePath . $file))
{
$folders .= urlencode($file) . "|";
}
}
}
}

closedir($dir_handle);
$folders = rtrim($folders,"|");
echo $folders;
?>&twg_random=1&twg_type=random&twg_random_size=200" border="0">

END of code.

Thanxs for your effort!
/Steffo

Author:  TinyWebGallery [ 2. Jan 2007, 13:46 ]
Post subject: 

what is that much code for? to detect your folders?

because this is already done in 1.6 :)

Author:  Steffo74 [ 2. Jan 2007, 13:49 ]
Post subject: 

Great!!

Is it green to "replace" twg with the new 1.6 version?

Looking forward to use the new version of your great program!

Author:  TinyWebGallery [ 2. Jan 2007, 14:00 ]
Post subject: 

basic functios - yes. couple of people already use it without any big problems.
(and updates are all really simple ;))

I only have to test Safari + the internationalization of the backend ist still in progress - but if you choose english for TWG Admin it's fine.

/Michael

Page 1 of 2 All times are UTC + 1 hour [ DST ]
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/