Simple Viewer - Can't change the directory!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
elmani
Forum Newbie
Posts: 2
Joined: Wed Aug 18, 2004 2:40 am

Simple Viewer - Can't change the directory!

Post by elmani »

Hi.

I've recently discovered a free piece of code to display images - it's called SimpleViewer. It can be found at:

http://www.airtightinteractive.com/simpleviewer/


The code basically display thumbnails and images - the image are stored in a directory called images.

According to the writer, you can modify the script so that the images can be stored in another directory - I've tried changing the script but it doesn't seem to work.

Any guru's that can help??

Thanks in advance :cry:
Grim...
DevNet Resident
Posts: 1445
Joined: Tue May 18, 2004 5:32 am
Location: London, UK

Post by Grim... »

Where's the code that you have changed?
elmani
Forum Newbie
Posts: 2
Joined: Wed Aug 18, 2004 2:40 am

Post by elmani »

feyd | Please use

Code: Select all

tags when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]


The code is below.

The instructions on the web site say:

To load images or thumbs from different folders than the default, use the imagePath and thumbPath attributes in the XML document. 

imagePath is an absolute or relative path to the folder containing the fullsize images. 
thumbPath is an absolute or relative path to the folder containing the thumbnail images. 
Note: Relative paths are relative to the HTML document that contains SimpleViewer. 
____________________________________________________________
I have therefore tried changing the name of the directory (from images to test) and then changed part of the code below to say:  imagePath="test"

Code: Select all

<?php
$xml = '<?xml version="1.0" encoding="UTF-8" ?>';
$xml .= '<SIMPLEVIEWER_DATA maxImageDimension="680" textColor="0xFFFFFF" frameColor="0xFFFFFF" frameWidth="20" stagePadding="40" thumbnailColumns="10" thumbnailRows="2" navPosition="bottom" navDirection="LTR" title="" imagePath="" thumbPath="">';

$count = "1";
$style = opendir("images");

	while($stylesheet = readdir($style)) {
		if ($stylesheet[0] != "." && $stylesheet[0] != ".." ) {
			$xml .= '<IMAGE>';
			$xml .= '<NAME>'.$stylesheet.'</NAME>';
			//add auto captions: 'Image X'
			$xml .= '<CAPTION>'.$stylesheet.'</CAPTION>';
			$xml .= '</IMAGE>';
			if (!file_exists("./thumbs/".$stylesheet))
			{
			$thumb=new thumbnail("./test/".$stylesheet);	
			$thumb->size_auto(60);
			$thumb->save("./thumbs/".$stylesheet);
			}
		$count++;
		}
	}
closedir($style);
$xml .= '</SIMPLEVIEWER_DATA>';
echo $xml;

?>


THANKS!!!!


feyd | Please use

Code: Select all

tags when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
Post Reply