Forums

PHP

This topic is locked

Can't get menus to load

Posted 02 Apr 2008 22:28:51
1
has voted
02 Apr 2008 22:28:51 Pia Oliver posted:
I have various includes, and can't get the menu to show, or the sidebar or the footer, or the slides in the slideshow in the header. They are all called via php includes.

The page is at <www.HeavenSentDesserts.net/cater/Wedding/phpslideshow.php>

The page should look like the home page, with a scrolling slideshow at top, sidebar, a drop down menu and footer.

Any help is much appreciated.

thanks,

Pia

Replies

Replied 03 Apr 2008 11:06:24
03 Apr 2008 11:06:24 Alan C replied:
Hi Pia,
your page loads ok, but I guess there is a lot missing. Your link has something on the end too that stops it loading when the link in your post is clicked.

We can't see the actual php because it gets parsed on the server - however, there are some lines that are visible, like this . . .

<pre id=code><font face=courier size=2 id=code>&lt;?php
$include_path = dirname(__FILE__);
require_once $include_path."../includes/footer.html"; ?&gt;
&lt;!--&lt;?php include($_SERVER['DOCUMENT_ROOT']."/includes/footer.html"; ?&gt;--&gt; </font id=code></pre id=code>

I'm not sure what's happening there, but if those are getting passed through into the html that is going to the browser then they are not getting interpreted as php, that is probably the cause.

Also, you might find issues with using paths based on your site root, but it looks like you are working around that with the include based on DOCUMENT_ROOT

If you are using DW check the lines right at the top of the code to see how it has done the includes, sometimes it uses virtual, which can lead to problems

Hope that helps
Replied 04 Apr 2008 01:25:54
04 Apr 2008 01:25:54 Pia Oliver replied:
I am getting more confused by the minute here. The "active" page is "phpslideshow.php" which calls on "template.php" which calls on the includes.

If I go to view &lt;www.heavensentdesserts.net/cater/Wedding/phpslideshow.php&gt; I get nothing but the slideshow; if I go to &lt;www.heavensentdesserts.net/cater/Wedding/template.php&gt; I get everything but the slideshow, and twice! There has to be some conflict somewhere between the calls, perhap in the javascripts also? This is way over my head and I have no clue where to go from here.

the code for the template is:

&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
&lt;!--&lt;?php
$include_path = dirname(__FILE__);
require_once $include_path."/../../includes/header3.html"; ?&gt;
&lt;?php
$include_path = dirname(__FILE__);
require_once $include_path."/../../includes/sidebar.html"; ?&gt;--&gt;
&lt;?php $docroot = $_SERVER['DOCUMENT_ROOT'];
include ($docroot."/includes/header3.html";?&gt;
include($_SERVER['DOCUMENT_ROOT']."/includes/header3.html";
&lt;?php include($_SERVER['DOCUMENT_ROOT']."/includes/sidebar.html"; ?&gt;

&lt;div id="content2"&gt;
&lt;script language="JavaScript"&gt;
&lt;!--
//preload the next image...
if (document.images)
{
pic1= new Image(800,600);
pic1.src="&lt;NEXT_IMAGE&gt;";
}
//--&gt;&lt;/script&gt;

&lt;div class='wrapper'&gt;
&lt;div class='show_title'&gt;
&lt;!-- &lt;SHOW_TITLE&gt;--&gt;
&lt;/div&gt;
&lt;div class='navigation'&gt;
&lt;BACK&gt; [&lt;POSITION&gt;] &lt;NEXT&gt;
&lt;/div&gt;
&lt;div class='image'&gt;
&lt;br /&gt;
&lt;IMAGE&gt;
&lt;br /&gt;
&lt;IMAGE_TITLE&gt;&nbsp;
&lt;EXIF_COMMENT&gt;
&lt;/div&gt;
&lt;div class="image_info"&gt;
&lt;AUTO_SLIDESHOW_LINK&gt;
|
&lt;a href="&lt;CURRENT_SHOW&gt;"&gt;beginning&lt;/a&gt;
|
&lt;a href="/"&gt;home&lt;/a&gt;
&lt;/div&gt;
&lt;div class='thumbnail_row'&gt; &lt;THUMBNAIL_ROW&gt; &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;a href="mailto: &Subject="Information on a very special cake, please!""&gt;Email Christian to set up an appointment for your wedding cake design and tasting!&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt; &lt;!-- end content2 div--&gt;
&lt;p class="brclear"&gt;&lt;/p&gt;
&lt;?php
$include_path = dirname(__FILE__);
require_once $include_path."/../../includes/footer.html"; ?&gt;

and for the phpslideshow.php

&lt;?php
/*
PHPSlideShow v0.9 written by Greg Lawler
from www.zinkwazi.com/scripts

v0.9.9.1 Nov 2006 - stop infinite auto slideshow
v0.9.9 June 2006 - added auto thumbnail creation
v0.9.8 June 2006 - fixed the pics.txt special characters bug <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
v0.9.7 May 2006 - fixed some Notify errors...
v0.9.6 Feb 2006 - Added the &lt;NEXT_IMAGE&gt; tag and javascrip preloading.
v0.9.5 Christmas 2005 - added sort by name and filmstrip thumbnail view
v0.9.2 Aug 2005 - depricated $GLOBALS[] replaced with _GET
v0.9.1 Aug 2005 - bug fixed to allow use on PHP &lt; 4.3
v0.9 June 2005 - major re-write, now template based
v0.6.2 august 2002 - minor upgrade, added javascript notes
v0.6.1 july 2002 - fixed special character bug.
v0.6 july 2002 - added lots of formatting options and a security patch
v0.5.1 march 2002 - minor bug fixes, reg exp fix...
v0.5 march 2002 - osx path fix, page headings for multi dir, cleaner...
v0.4 july 10 2001
v0.3.5 july 5 2001
v0.3.4 april 19 2001
v0.3.3 january 9 2001
v0.3.1 september 29 2000 - added support for navigation image buttons
v0.3 september 12 2000 - added support for image descriptions
v0.2 august 28 2000

PHPSlideshow is relesed under the GPL
See the license at www.gnu.org/licenses/gpl.txt
Feel free to use/modify this little script

IMPORTANT NOTE.... <img src=../images/dmxzone/forum/icon_smile_wink.gif border=0 align=middle>
if you want to send me a token of appreciation, i like coffee so
anything from www.starbucks.com/card will be gladly accepted <img src=../images/dmxzone/forum/icon_smile_wink.gif border=0 align=middle>
my address is:
attention: greg lawler
801 alston road, santa barbara, ca 93108 usa

INSTALLATION: See README.txt

enjoy <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
greg
*/

// NOTE: your phpslideshow.php script will work "out of the box" and
// all layout and visual effects are controlled by the template.html file.
// you can fine tune your slideshow by editing some of these settings.

// ------------- BEGIN CONFIG SECTION --
// error reporting
// error_reporting(E_ALL);

// number of thumbnails to display f a thumbnail directory exists
// (note that this will be rounded down to an odd
// number if you use $thumbnail_view = "circular";.)
$thumb_row = 25;

// thumbnail directory name (no slashes needed)
$thumbnail_dir = "thumbnails";

// do you want to automatically generate thumbnails?
// if this is set to true, you will need to provide your web site
// ftp login info and web root directory below.
// NOTE: Thumbnails are created the first time you view the slideshow.
$create_thumbnails = "true";
//$create_thumbnails = "false";

// ftp user information for automatic thumbnails
$ftp_username = "charlotterusse";
$ftp_password = "HSDpia1";

// ftp web root directory (httpdocs, wwwroot, webroot etc.)
// this is the directory that your website is located in on your FTP login.
// (no slashes needed)
$ftp_web_root = "";

// thumbnail size
$thumbnail_max_width = 60;
$thumbnail_max_height = 40;

// $thumbnail_style: "scale" will resize and maintain proportions to the original image
// "crop" will resize to exactly the thumbnail size you specify
$thumbnail_style = "crop";

// output quality: 60 = poor quality tiny file, 100 = best quality larger file...
$thumbnail_quality = 80;

// this should work as localhost but if not, insert your ftp server's name
$ftp_hostname = "localhost";

// sort/display images with newest or oldest on top or alphabetically by name.
// this has no effect when pics.txt is used.
// $sort_images = "oldest";
//$sort_images = "newest";
$sort_images = "name";

// thumbnail view: can be "filmstrip" or "circular"
//$thumbnail_view = "circular";
$thumbnail_view = "filmstrip";

// name of file containing optional page headings
$heading_info_file = "heading.txt";

// file containing optional image descriptions
$pic_info_file="pics.txt";

// language text for various areas...
$lang_back = "back";
$lang_next = "next";
$lang_of = "of";
$lang_stop_slideshow = "stop slideshow";
$lang_start_slideshow = "start slideshow";
$lang_img_hover = "click for next image...";
$lang_img_alt = "slideshow image";

// automated slideshow options
// remember that you need &lt;META_REFRESH&gt; in the &lt;head&gt; section of your html
// AND the &lt;AUTO_SLIDESHOW_LINK&gt; tag in your page.
// $delay is the number of seconds to pause between slides...
$delay = 2;
// set to true to display navigation icons instead of text...
$show_navigation_buttons = "false";
$back_button = "/back.gif";
$next_button = "/next.gif";

// ------------- END CONFIG SECTION --

################################################################################
// begin code :: don't make changes below this line...

// initialize some stuff:
$auto_url = "";
$thumbnail_actual_width = "";
$thumbnail_actual_height = "";

// grab the variables we want set for newer php version compatability
$phpslideshow = isset($_GET['phpslideshow']) ? $_GET['phpslideshow'] : '';
$path_to_images = isset($_GET['directory']) ? $_GET['directory'] : '';
$currentPic = isset($_GET['currentPic']) ? $_GET['currentPic'] : '';
$browse = isset($_GET['browse']) ? $_GET['browse'] : '';
$auto = isset($_GET['auto']) ? $_GET['auto'] : '';

// check for platform dependent path info... (for windows and mac OSX)
$path = empty($HTTP_SERVER_VARS['PATH_INFO'])?
$HTTP_SERVER_VARS['PHP_SELF']:$HTTP_SERVER_VARS['PATH_INFO'];

// this only works on php &gt; 4.3, replacing with file()
//if( file_exists( "template.php" ) ) $template = file_get_contents("template.php";
if( file_exists( "template.php" ) ) $template = implode("", file('template.php'));
else {
echo "&lt;b&gt;ERROR:&lt;/b&gt; Can't find the template.php file!";
exit;
}

// check that the user did not change the path...
if (preg_match('<img src=../images/dmxzone/forum/icon_smile_sad.gif border=0 align=middle>\.\.|^/|\<img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>:', $path_to_images) || strpos($path_to_images, $thumbnail_dir) !== false) {
echo "&lt;strong&gt;ERROR:&lt;/strong&gt; Your request contains an invalid path.&lt;br /&gt;
Can not locate &lt;strong&gt;$path_to_images&lt;/strong&gt; in this directory.&lt;br /&gt;";
exit;
}

if (empty($path_to_images)) $path_to_images = ".";
// if there is no $heading_info_file (see format above) set page heading here
if ( !file_exists("$path_to_images/$heading_info_file") {
$header = "PHPSlideshow by greg lawler at zinkwazi.com";
$title = "&lt;a href=\"www.zinkwazi.com/\"&gt;PHPSlideshow by greg lawler at zinkwazi.com&lt;/a&gt;";
}
else {
$heading_info = file("$path_to_images/$heading_info_file";
$header = "$heading_info[0]";
$title = $header;
}
$template = str_replace("&lt;SHOW_TITLE&gt;",$title,$template);
$template = str_replace("&lt;WINDOW_TITLE&gt;",$header,$template);

// image / text buttons
if ($show_navigation_buttons == "true" {
$back_src = "&lt;img src='$back_button' alt='back' class='nav_buttons' class='nav_buttons'&gt;";
$next_src = "&lt;img src='$next_button' alt='next' class='nav_buttons' class='nav_buttons'&gt;";
}
else {
$back_src = "$lang_back";
$next_src = "$lang_next";
}

if ( !file_exists("$path_to_images/$pic_info_file") {
$dh = opendir( "$path_to_images" );
$pic_info = array();
$time_info = array();
while( $file = readdir( $dh ) ) {
// look for these file types....
if (preg_match('/(jpg|jpeg|gif|png)$/i',$file)) {
$time_info[] = filemtime("$path_to_images/$file";
$pic_info[] = $file;
}
}
if ($sort_images == 'name') {
natcasesort($pic_info);
$pic_info = array_reverse(array_reverse($pic_info)); //resetting array keys
}
else {
$sortorder = $sort_images == "oldest" ? SORT_ASC : SORT_DESC;
array_multisort($time_info, $sortorder, $pic_info, SORT_ASC, $time_info);
}
}
else {
$pic_info=file("$path_to_images/$pic_info_file";
}

// begin messing with the array
$number_pics = count ($pic_info);
if (($currentPic &gt; $number_pics)||($currentPic == $number_pics)||!$currentPic)
$currentPic = '0';
$item = preg_split('/;/', rtrim($pic_info[$currentPic]), 2);
$last = $number_pics - 1;
$next = $currentPic + 1;
$next_item = @preg_split('/;/', rtrim($pic_info[$next]), 2);
if ($currentPic &gt; 0 ) $back = $currentPic - 1;
else $currentPic = "0";


$blank = empty($item[1])?'&nbsp;':$item[1];

if ($currentPic &gt; 0 ) $nav=$back;
else $nav=$last;
$nav = "&lt;a href='$path?directory=$path_to_images&currentPic=$nav'&gt;$back_src&lt;/a&gt;";
$current_show = "$path?directory=$path_to_images";
$next_link = "&lt;a href='$path?directory=$path_to_images&currentPic=$next'&gt;$next_src&lt;/a&gt;";
$template = str_replace("&lt;CURRENT_SHOW&gt;",$current_show,$template);
$template = str_replace("&lt;BACK&gt;",$nav,$template);
$template = str_replace("&lt;NEXT&gt;",$next_link,$template);
$template = str_replace("&lt;POSITION&gt;","$next $lang_of $number_pics",$template);


// {{{ ------- EXIF stuff

//get comments from the EXIF data if available...
if(extension_loaded('exif')) {
$curr_image = "$path_to_images/$item[0]";
$all_exif = @exif_read_data($curr_image,0,true);
$exifhtml = @$all_exif['COMPUTED'];
$comment = @$all_exif['COMMENT'][0];
if (!empty($comment)) {
$template = str_replace("&lt;EXIF_COMMENT&gt;",$comment,$template);
}
}
// }}}

$image_title = isset($item[1]) ? $item[1] : '';
$template = str_replace("&lt;IMAGE_TITLE&gt;",$image_title,$template);

// {{{ ------- my_circular($a_images, $currentPic, $thumb_row);

function my_circular($thumbnail_dir, &$template, $a_images, $currentPic, $thumb_row, $path_to_images) {
global $path;
global $auto_url;

// get size of $a_images array...
$number_pics = count($a_images);
// do a little error checking...
if ($currentPic &gt; $number_pics) $currentPic = 0;
if ($currentPic &lt; 0) $currentPic = 0;
if ($thumb_row &lt; 0) $thumb_row = 1;

// check if thumbnail row is greater than number of images...
if ($thumb_row &gt; $number_pics) $thumb_row = $number_pics;

// split the thumbnail number and make it symmetrical...
$half = floor($thumb_row/2);

// show thumbnails
// left hand thumbs
if (($currentPic - $half) &lt; 0) { // near the start...
$underage = ($currentPic-1) - $half;
for ( $x=($number_pics-abs($underage+1)); $x&lt;$number_pics; $x++) {
$next=$x;
$item = preg_split('/;/', rtrim($a_images[$x]), 2);
$out .= "\n&lt;a href='$path?directory=$path_to_images$auto_url&currentPic=$next' class='thumbnail'&gt;&lt;img src='$path_to_images/$thumbnail_dir/".$item[0]."' class='thumbnail'&gt;&lt;/a&gt;";
}
for ( $x=0; $x&lt;$currentPic ; $x++ ) {
$next=$x;
$item = preg_split('/;/', rtrim($a_images[$x]), 2);
$out .= "\n&lt;a href='$path?directory=$path_to_images$auto_url&currentPic=$next' class='thumbnail'&gt;&lt;img src='$path_to_images/$thumbnail_dir/".$item[0]."' class='thumbnail'&gt;&lt;/a&gt;";
}
}
else {
for ( $x=$currentPic-$half; $x &lt; $currentPic; $x++ ) {
$next=$x;
$item = preg_split('/;/', rtrim($a_images[$x]), 2);
$out .= "\n&lt;a href='$path?directory=$path_to_images$auto_url&currentPic=$next' class='thumbnail'&gt;&lt;img src='$path_to_images/$thumbnail_dir/".$item[0]."' class='thumbnail'&gt;&lt;/a&gt;";
}
}

// show current (center) image thumbnail...
$item = preg_split('/;/', rtrim($a_images[$currentPic]), 2);
$out .= "\n&lt;img src='$path_to_images/$thumbnail_dir/".rtrim($item[0])."' class='thumbnail_center'&gt;";

// array for right side...
if (($currentPic + $half) &gt;= $number_pics) { // near the end
$overage = (($currentPic + $half) - $number_pics);
for ( $x=$currentPic+1; $x &lt; $number_pics; $x++) {
$next=$x;
$item = preg_split('/;/', rtrim($a_images[$x]), 2);
$out .= "\n&lt;a href='$path?directory=$path_to_images$auto_url&currentPic=$next' class='thumbnail'&gt;&lt;img src='$path_to_images/$thumbnail_dir/".$item[0]."' class='thumbnail'&gt;&lt;/a&gt;";
}
for ( $x=0; $x&lt;=abs($overage); $x++) {
$next=$x;
$item = preg_split('/;/', rtrim($a_images[$x]), 2);
$out .= "\n&lt;a href='$path?directory=$path_to_images$auto_url&currentPic=$next' class='thumbnail'&gt;&lt;img src='$path_to_images/$thumbnail_dir/".$item[0]."' class='thumbnail'&gt;&lt;/a&gt;";
}
}
else {
for ( $x=$currentPic+1; $x&lt;=$currentPic+$half; $x++ ) { // right hand thumbs
$next=$x;
$item = preg_split('/;/', rtrim($a_images[$x]), 2);
$out .= "\n&lt;a href='$path?directory=$path_to_images$auto_url&currentPic=$next' class='thumbnail'&gt;&lt;img src='$path_to_images/$thumbnail_dir/".$item[0]."' class='thumbnail'&gt;&lt;/a&gt;";
}
}
$template = str_replace("&lt;THUMBNAIL_ROW&gt;",$out,$template);
}
// }}}
// {{{ ------- my_filmstrip($a_images, $currentPic, $thumb_row);

function my_filmstrip($thumbnail_dir, &$template, $a_images, $currentPic, $thumb_row, $path_to_images) {
global $path;
global $auto_url;

// get size of $a_images array...
$number_pics = count($a_images);
// do a little error checking...
if ($currentPic &gt; $number_pics) $currentPic = 0;
if ($currentPic &lt; 0) $currentPic = 0;
if ($thumb_row &lt; 0) $thumb_row = 1;
if ($thumb_row &gt; $number_pics) $thumb_row = $number_pics;

if ($currentPic &gt;= $thumb_row) {
$start = $currentPic - $thumb_row + 1;
}
else {
$start = 0;
}

$out = '';
for ($x = $start; $x &lt; ($start + $thumb_row); $x++ ) {
$item = preg_split('/;/', rtrim($a_images[$x]), 2);
$class = $x == $currentPic ? 'thumbnail_center' : 'thumbnail';
$out .= "\n&lt;a href='$path?directory=$path_to_images$auto_url&currentPic=$x' class='thumbnail'&gt;&lt;img src='$path_to_images/$thumbnail_dir/".$item[0]."' class='$class'&gt;&lt;/a&gt;";
}

$template = str_replace("&lt;THUMBNAIL_ROW&gt;",$out,$template);
}
// }}}
// {{{ meta refresh stuff for auto slideshow...
// thanks to tim barmann for the bandwidth saving hack to stop auto slideshow at the last image.
if (($auto == "1" && ($currentPic &lt; $number_pics-1)) {
$auto_url = "&auto=1";
$meta_refresh = "&lt;meta http-equiv='refresh' content='".$delay;
$meta_refresh .= ";url=".$path."?directory=".$path_to_images.$auto_url."&currentPic=".$next."'&gt;";
$template = str_replace("&lt;META_REFRESH&gt;",$meta_refresh,$template);
$auto_slideshow = "&lt;a href='$path?directory=$path_to_images&currentPic=$currentPic'&gt;$lang_stop_slideshow&lt;/a&gt;\n";
$template = str_replace("&lt;AUTO_SLIDESHOW_LINK&gt;",$auto_slideshow,$template);
}
else {
$template = str_replace("&lt;META_REFRESH&gt;","",$template);
$auto_slideshow = "&lt;a href='$path?directory=$path_to_images&auto=1&currentPic=$next'&gt;$lang_start_slideshow&lt;/a&gt;\n";
$template = str_replace("&lt;AUTO_SLIDESHOW_LINK&gt;",$auto_slideshow,$template);
}
// }}}

$images = "&lt;a href='$path?directory=$path_to_images$auto_url&currentPic=$next'&gt;";
$images .= "&lt;img src='$path_to_images/$item[0]' class='image' alt='$lang_img_alt' title='$lang_img_hover'&gt;&lt;/a&gt;";
$template = str_replace("&lt;IMAGE&gt;",$images,$template);
$next_image = "$path_to_images/$next_item[0]";
$template = str_replace("&lt;NEXT_IMAGE&gt;",$next_image,$template); // useful for prefetching

if( file_exists( "$path_to_images/$thumbnail_dir" ) ) {
if( $thumbnail_view == "circular" ) {
my_circular($thumbnail_dir, $template, $pic_info, $currentPic, $thumb_row, $path_to_images);
}
else {
my_filmstrip($thumbnail_dir, $template, $pic_info, $currentPic, $thumb_row, $path_to_images);
}
}

$image_filename = "$item[0]";
$template = str_replace("&lt;IMAGE_FILENAME&gt;",$image_filename,$template);

// {{{ ----- create the thumbnails and set the permissions...
// the credit for this litte bit of genius goes to Jon from spiicytuna.org who suggested writing the directory
// and permissions via ftp and sent me some code to prove his point <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>.
if ($create_thumbnails == "true" {
$full_www_path = dirname ($path);
$full_ftp_path = $ftp_web_root."/".$full_www_path;
$thumbnail = $path_to_images."/".$thumbnail_dir."/".$item[0];
if (file_exists($thumbnail)) {
// echo "The thumbnail $thumbnail exists";
} else {
// create the thumbnail directory for writing
create_directory($full_ftp_path, $thumbnail_dir, $path_to_images, $ftp_hostname, $ftp_username, $ftp_password);
// location of the original image
$sourcefile = "$path_to_images/$item[0]";
// output file
$targetfile = $thumbnail;
/* Create a new image object (not neccessarily true colour) */
$source_id = null;
// prep according to image type
if (preg_match('/(jpg|jpeg)$/i',$sourcefile)) $source_id = imageCreatefromjpeg("$sourcefile";
elseif (preg_match('/(png)$/i',$sourcefile)) $source_id = imageCreatefrompng("$sourcefile";
elseif (preg_match('/(gif)$/i',$sourcefile)) $source_id = imageCreatefromgif("$sourcefile";
else die("Unknown image file type";
/* Get the dimensions of the source picture */
$source_width = imagesx($source_id);
$source_height = imagesy($source_id);
// scale or crop during thumbnail resize
$scale = max($thumbnail_max_width/$source_width, $thumbnail_max_height/$source_height);
if($scale &lt; 1) {
$thumbnail_actual_width = floor($scale * $source_width);
$thumbnail_actual_height = floor($scale * $source_height);
$target_id=imagecreatetruecolor($thumbnail_actual_width, $thumbnail_actual_height);
if(function_exists('imagecopyresampled')) {
$target_pic=imagecopyresampled($target_id,$source_id,0,0,0,0,$thumbnail_actual_width,$thumbnail_actual_height,$source_width,$source_height);
}
else {
$target_pic=imagecopyresized($target_id,$source_id,0,0,0,0,$thumbnail_actual_width,$thumbnail_actual_height,$source_width,$source_height);
}
imagedestroy($source_id);
$source_id = $target_id;
}
if($thumbnail_style == "crop" {
$target_id=imagecreatetruecolor($thumbnail_max_width, $thumbnail_max_height);
if(function_exists('imagecopyresampled')) {
$target_pic=imagecopyresampled($target_id,$source_id,0,0,0,0,$thumbnail_max_width,$thumbnail_max_height,$thumbnail_max_width,$thumbnail_max_height);
}
else {
$target_pic=imagecopyresized($target_id,$source_id,0,0,0,0,$thumbnail_max_width,$thumbnail_max_height,$thumbnail_max_width,$thumbnail_max_height);
}
imagedestroy($source_id);
$source_id = $target_id;
}
imagejpeg ($target_id,"$targetfile",$thumbnail_quality);
}
}
// {{{ ----- create_directory($full_ftp_path, $thumbnail_dir, $path_to_images, $ftp_hostname, $ftp_username, $ftp_password)
function create_directory($full_ftp_path, $thumbnail_dir, $path_to_images, $ftp_hostname, $ftp_username, $ftp_password) {
$new_thumbnail_dir = $path_to_images."/".$thumbnail_dir;
//check to see if the directory is already there....
if(file_exists($new_thumbnail_dir)){
// check permissions for writing
if (!is_writable($new_thumbnail_dir)) {
chmod_ftp_directory($full_ftp_path, $thumbnail_dir, $path_to_images, $ftp_hostname, $ftp_username, $ftp_password);
}
}
else{
$conn_id = ftp_connect($ftp_hostname);
// login with username and password
$login_result = ftp_login($conn_id, $ftp_username, $ftp_password);
// try to chmod $path directory
if (!ftp_chdir($conn_id, $full_ftp_path)) die("FTP ERROR: ftp_web_root directory not found.";
if(ftp_mkdir($conn_id, $new_thumbnail_dir)) {
ftp_site($conn_id, "CHMOD 777 $new_thumbnail_dir" or die("FTP ERROR: unable to write to server.";
return true;
} else {
return false;
}
// close the FTP connection
ftp_close($conn_id);
return true;
}
}
// }}}
// {{{ ----- function chmod_ftp_directory($full_ftp_path, $thumbnail_dir, $path_to_images, $ftp_hostname, $ftp_username, $ftp_password)
function chmod_ftp_directory($full_ftp_path, $thumbnail_dir, $path_to_images, $ftp_hostname, $ftp_username, $ftp_password) {
$new_thumbnail_dir = $path_to_images."/".$thumbnail_dir;
$conn_id = ftp_connect($ftp_hostname);
// login with username and password
$login_result = ftp_login($conn_id, $ftp_username, $ftp_password);
// try to chmod $path directory
if (!ftp_chdir($conn_id, $full_ftp_path)) die("FTP ERROR: ftp_web_root directory not found.";
if (!ftp_site($conn_id, "CHMOD 777 $new_thumbnail_dir") die("FTP ERROR: unable to write to server.";
// close the FTP connection
ftp_close($conn_id);
return true;
}
// }}}
// }}}
echo $template;
?&gt;


thank you so much for any help!

Pia
Replied 04 Apr 2008 11:22:56
04 Apr 2008 11:22:56 Alan C replied:
HI again Pia
I can see that

www.heavensentdesserts.net/cater/wedding_hsd/weddingcakes.php

is working well, which I guess is doing the same thing. I have not used this slideshow but did some work using another one that needed manual configuration, it was very picky - by that I mean it was really difficult to edit the code and get it right, in the end I wrote a special script that put the images into the show - took much longer than it ought to have done.

I don't think I can do much more with it

One way to tackle it that sometimes helps is to start afresh on a small scale, perhaps with one or two images then see if that gets working, in the past I've had pages of code that would not work, so threw them away and started again - I think that there can be odd characters in there sometimes that just don't show on the screen but screw things up.

Reply to this topic