I tested the concept and it doesn't work. You might be able to get the ads turned off for the one file. The ads would never be seen anyway.
Another option would be to make the page, in this case test4.html, a PHP page (test4.php). Then we could put a modified version of the PHP code from getalbumpics.php right on the page. Ads would no longer be a problem because, although the page would still have them, they wouldn't be in a spot that interferes with the code.
So on the now renamed test4.php page, replace:
Code:
<script type="text/javascript" src="http://www.freshmeadowscranberries.com/images/history/getalbumpics.php?id=jaguar"></script>
with:
Code:
<script type="text/javascript">
<?php
$photovar = 'jaguar';
$dirname = 'images/history/';
if (phpversion() >= 5.1){
@date_default_timezone_set(date_default_timezone_get());
}
function returnimages() {
global $dirname;
$pattern='/\.(jpg|jpeg|png|gif|bmp)$/i';
$curimage=0;
if($handle = opendir($dirname)) {
while(false !== ($file = readdir($handle))){
if(preg_match($pattern, $file)){
$filedate=date ("M d, Y H:i:s", filemtime($dirname . $file));
echo " [$curimage, \"$file\", \"$filedate\"],\n";
$curimage++;
}
}
echo ' ["placeholder"]' . "\n";
closedir($handle);
}
}
if (!preg_match('/^[a-z_][a-z0-9_]+$/i', $photovar)){
echo 'alert("Photo Album ID must contain only letters, numbers, or underscore, and cannot start with a number")';
die();
}
echo "var $photovar={\n";
echo " baseurl: \"http://" . $_SERVER["SERVER_NAME"] . dirname($_SERVER['PHP_SELF']) . "/" . $dirname . "\",\n";
echo " images: [\n";
returnimages();
echo " ],\n";
echo " desc: []\n";
echo "}\n";
?>
</script>
Notice the two highlighted variables at the beginning. The $photovar is the same as what would have been id from the old method, and the $dirname is the relative path to the images.
I've already set them to what they need to be for test4.php.
Bookmarks