*/ $folder = "images/devpartners/"; // if your photos are in a different folder specify it here // example: var folder = 'images/'; // or same folder as this file then: var folder = './'; $photosize = 200; // width to show photos at $quality = 100; // image quality; 100 = highest quality and largest file size // keep the quality at 70 or lower if you are getting image flicker because // of loading of the image files between transitions $get_exif = 1; // 0 = Do not load exif description data from jpg's; 1 = load exif descriptions from jpg's $get_iptc = 1; // 0 = Do not load iptc description data from jpg's; 1 = load iptc descriptions from jpg's $phwidth = 250; // pictureholder width $phheight = 100; // pictureholder height $phheight = 100; // pictureholder height // pictureholder DIV also has the class 'pictureholder' so you can add CSS border etc. $seconds = 5; // switch photos n seconds $randomize_photos = 1; // 0 = Do not randomize photos; 1 = Randomize photos $display_caption = 0; // 0 = No caption; 1 = Display exif jpg Description below photo $caption_height = 50; // How many pixels high for caption box if on $caption_border = 1; // Caption border pixels // captionholder DIV has the class 'captionholder' so you can add CSS $pan_zoom = 1.3; // how many times to zoom before panning $trans = "slide(left)"; // default transition between photos $effect = "none"; // default effect on photos /* The trans variable stands for transitions. The following trans are possible: none, random, crossfade, zoom(from), wipe(from), slide(from) from = upperleft, top, upperright, left, center, right, lowerleft, bottom, lowerright (*slide does not support center) (**wipe supports left, right, center, top and bottom) */ /* The effect variable is for photo effects. Possible options are: none, random, zoomin(to), zoomout(to), pan(to) to = upperleft, top, upperright, left, center, right, lowerleft, bottom, lowerright (*pan does not support center) */ $cur_pic = 0; // which photo to start with. 0 is first photo in album. $trans_amount = 20; // amount of steps for transitions $effect_amount = 100; // amount of steps for effects $testing_mode = 0; // 0 = off; 1 = on; testing mode creates a DIV with ID testing to display testing info /* The following time variables are in milliseconds. If you see a flicker of a background photo after a transition then you may want to increase the flicker time. You can also play with the other time variables if animation is not smooth. */ $flicker_time = 500; // ms between photo operations $opacity_time = 400; // ms between opacity $trans_time = 32; // ms between transition steps $effect_time = 32; // ms between effect steps /* You may also specify transitions, effects, and time in JPG Exif comments. If you specify these then they override the default settings above. The format is similar to a combination of HTML and Javascript. Just add the code to a JPG Photo comment and that photo will be effected by the code. Examples: time is the amount of seconds to display a photo. Anything else you have in the description including HTML markups will display in the caption box if you have captions turned on above. */ /* DO NOT CHANGE ANY VARIABLES BELOW */ $error = ''; // Log errors for when we get to javascript //This function gets the file names of all images in the current directory //and ouputs them as a JavaScript array function returnimages() { global $folder, $photosize, $get_exif, $get_iptc, $error; $self = $_SERVER['SCRIPT_NAME']; // current file and path (Ex: /images/readimages.php) $uri = $_SERVER['REQUEST_URI']; // (Ex: /images/readimages.php?width=640) $query = $_SERVER['QUERY_STRING']; // (Ex: width=640) $pattern="/(\.jpg$)|(\.png$)|(\.jpeg$)|(\.gif$)/i"; //valid image extensions $exifpattern="/(\.jpg$)|(\.jpeg$)/i"; // valid exif jpg extensions //$files = array(); $curimage=0; $comments=''; // I made a mistake. I must have taken this function from Cool Gallery. The slideshow only uses comments // and it should be taken from comments, not title!!!! $title=''; if($handle = opendir($folder)) { while(false !== ($file = readdir($handle))) { if(preg_match($pattern, $file)) //if this file is a valid image { $comments = $title = ""; // blank out variables // Get photo IPTC Data v1.2h 11/21/11 $actual_size = getimagesize($folder.$file, $info); if(isset($info['APP13']) && $get_iptc==1) { $iptc = iptcparse($info['APP13']); $title = $iptc["2#105"][0]; // IPTC Headline $comments = $iptc["2#120"][0]; // IPTC Caption } if(preg_match($exifpattern, $file)) if(function_exists('exif_read_data') && $get_exif==1) { $exif = exif_read_data($folder.$file, 0, true); //echo "
".$file."
\n"; $title = $exif['WINXP']['Title']; // Comes from windows $comments = $exif['WINXP']['Comments']; // Comes from windows if ($comments == '') // if empty $comments = $exif['COMMENT']['0']; // comes from jpg comment /*echo "Title:".$exif['IFD0']['Title']."
"; // Comes from windows echo "Comments:".$exif['IFD0']['Comments']."
"; // Comes from windows echo "COMMENT.0:".$exif['COMMENT']['0']."
"; // comes from jpg comment */ } // end if function exists $temp2 = preg_replace("/]*>/is", "", $comments); $temp2 = preg_replace("/]*>/is", "", $temp2); $temp2 = preg_replace("/]*>/is", "", $temp2); $temp2 = preg_replace("/]*>/is", "", $temp2); $order = array("\r\n", "\n", "\r"); // v. 1.2h 11/21/11 $replace = '
'; // Processes \r\n's first so they aren't converted twice. $title = str_replace($order, $replace, $title); $comments = str_replace($order, $replace, $comments); $temp2 = str_replace($order, $replace, $temp2); //Output it as a JavaScript array element //echo ''; // Not sure but I may need to urlencode $folder and $file ?? Is this true? echo 'pictures['.$curimage.'].photo.src="'.$self.'?image='.$folder.$file.'&width='.$photosize.'";'.chr(13); // Vlad wanted the statement below to load images directly without using php: //echo 'pictures['.$curimage.'].photo.src="'.$folder.$file.'";'.chr(13); $curimage++; } } if ($get_exif==1) // Bug fix 3/29/10 - Did not have this if statement before v. 1.2e if(!function_exists('exif_read_data')) { $error .= "Your server does not have EXIF Enabled.". " Please change '\$get_exif=0' instead of 1."; } closedir($handle); } //return($files); } // end function returnimages(); function display_image($image_file, $photosize) // Outputs a dynamically resized image { global $quality; /* All these caching image Header settings seem to do nothing if IE is set to: Tools -> Internet Options -> Settings -> "Every visit to the page". But the slideshow runs smoothly without any headers also if IE is set to: Tools -> Internet Options -> Settings -> "Automatically". */ /* Bug Fix: 2/22/10 - As noted by Vlad M. I needed to move these headers to the top of the function for them to cache correctly, because all headers need to be before output such as the imagejpg or imagegif function. Still working on content-length... */ $offset = 60*60*24*30; // one month to cache //Header('Content-Length: '. $size); Header('Cache-Control: public, max.age='.$offset); Header('Expires: '. gmdate('D, d M Y H:i:s', time() + $offset) .' GMT'); Header('Pragma: cache'); Header('Cache-Control: post-check=3600,pre-check=43200'); if (!$photosize) // if no width defined $photosize = 150; // then make our own width // Actual Image Dimensions $actual_size = GetImageSize($image_file); $actual_width = $actual_size[0]; $actual_height = $actual_size[1]; // calculate new width and height and preserve aspect ratio if ($actual_width > $photosize) { $perc = $actual_width / $photosize; // this preserves aspect ratio $new_width = floor($actual_width / $perc); $new_height = floor($actual_height / $perc); } else if ($actual_width <= $photosize) // Bug fix 4/14/09 { // previously I was not even setting $new_width and $new_height // if $actual_width was smaller than $photosize $new_width = $actual_width; $new_height = $actual_height; } if($actual_size['mime'] == 'image/jpeg') { $img = imagecreatefromjpeg($image_file); $new_img = imagecreatetruecolor($new_width, $new_height); // copy old $img into $new_img with new width and height imagecopyresampled($new_img, $img, 0, 0, 0, 0, $new_width, $new_height, $actual_width, $actual_height); Header("Content-type: image/jpeg"); imagejpeg($new_img,'', $quality); // image, filename or none, quality } else if($actual_size['mime'] == 'image/png') { $img = imagecreatefrompng($image_file); $new_img = imagecreatetruecolor($new_width, $new_height); // copy old $img into $new_img with new width and height imagecopyresampled($new_img, $img, 0, 0, 0, 0, $new_width, $new_height, $actual_width, $actual_height); Header("Content-type: image/png"); imagepng($new_img,'', $quality); // image, filename or none, quality } else if($actual_size['mime'] == 'image/gif') { $img = imagecreatefromgif($image_file); // Bug fix 4/14/09 Accidently had imagecreatefrom png here $new_img = imagecreatetruecolor($new_width, $new_height); // copy old $img into $new_img with new width and height imagecopyresampled($new_img, $img, 0, 0, 0, 0, $new_width, $new_height, $actual_width, $actual_height); Header("Content-type: image/gif"); imagegif($new_img,'', $quality); // image, filename or none, quality } imagedestroy($img); imagedestroy($new_img); } // end function display_image() if (isset($_GET['image'])) { $image_file = $_GET['image']; $photosize = (!isset($_GET['width'])) ? 150 : $_GET['width']; display_image($image_file, $photosize); // if this is a photo source then just display image exit(); // and then exit } Header("content-type: application/x-javascript"); if ($error != '') // if there is an error than print it. { addslashes($error); echo 'document.write("

Error: '.$error.'");'.chr(13); } //echo ''; ?> //