Monday, April 21, 2008

New Blog

I started writing a new blog this evening. ("This evening" being a relative terms since it is now 12:29am my time.) It is tec's christian blog where I will write about my christian faith, and my experiences at church or whatever else I feel is appropriate for a blog of that title.

This is the beginning of my goal of creating and keeping up 100 different blogs. That's quite a goal, but I want to see if it can be done. In no way do I expect to post to all 100 blogs every day, but if I can come up with 100 different types of blog and post to them once or twice a week, I'll be doing good.

Check out

Tuesday, April 15, 2008

Grab images from a menalto gallery

I needed to grab images, 3 at a time, from a menalto gallery and put them on the bottom of other pages. This could be an include were $dir is specified and "albumname" could be changed to $albumname. I judge my own code to be a bit sloppy, but it works. Maybe this will point someone in the right direction.

It detects going too far previous or too far "next". It allows for counted pages. If the number of pages is not divisible by 3, the last page is handled correctly. The numbered page you are on is not a link. There is a previous and next link that appear only when applicable. The links have the rel="nofollow" attribute so that the S.E.s don't find a bunch of basically duplicate pages.

Admittedly this would be better with colorized text, but here's a quick rendering of it. (if you copy this, be sure to paste it into a text only editor.)


$dir = 'gallery/albums/albumname';



foreach($photosdb as $line){


//echo $photosdb[$count];





foreach($newphotosdb as $photo){






//echo("$counta $photo<br><br>");




// open specified directory

$dirHandle = opendir($dir);

$count = -1;

$returnstr = "";

while ($file = readdir($dirHandle)) {

// if not a subdirectory and if filename contains the string '.jpg' or '.jpeg'

if(!is_dir($file) && (strpos($file, '.jpg')>0 strpos($file, '.jpeg')>0)&&
ereg('thumb',$file)) {

// update count and string of files to be returned





//$returnstr .= '&';

//echo $returnstr;


//echo("begin corry test");


// foreach ($returnstr as $link){

// $countb++;

// $unthumb=str_replace('.thumb.jpg','',$link);

// $unthumb=str_replace('.thumb.jpeg','',$link);

// echo('<a target="_blank" href="'.$unthumb.'"><img
border="0" src="'.$dir.'/'.$link.'"></a> '.$countb.'<br>');

// }

//echo count($returnstr);

$num_of_images=count($returnstr)-1; // I actually mis-named this variable, but
it made sense (to me) at the time. It is actually the highest index number in
the array.

if($_GET['startimage']=="" $_GET['startimage']<0){$startimage="0";}else{$startimage=$_GET['startimage'];}

if($startimage > $num_of_images){$startimage=$num_of_images;}

// full size images are loaded with a SEFU. Take out "thumb" for full size image
and ".jpg" for SEFU.





<table border="1" cellpadding="3" cellspacing="0" style="border-collapse:
collapse" bordercolor="#111111" width="500" id="AutoNumber1">


<td width="33%" align="center">

<p align="center"><?php echo('<a target="_blank" href="'.$unthumb1.'"><img
border="0" src="'.$dir.'/'.$returnstr[$startimage].'"></a>');?></td>

<?php if($num_of_images>=$startimage+1){ ?>

<td width="33%" align="center"><?php echo('<a target="_blank" href="'.$unthumb2.'"><img
border="0" src="'.$dir.'/'.$returnstr[$startimage+1].'"></a>');?></td>

<?php }?>

<?php if($num_of_images>=$startimage+2){ ?>

<td width="34%" align="center"><?php echo('<a target="_blank" href="'.$unthumb3.'"><img
border="0" src="'.$dir.'/'.$returnstr[$startimage+2].'"></a>');?></td>

<?php }?>



<?php // the $unthumb variable happen to have the filname without extension,
which I need here as an array index.


<td width="33%" align="center"><?php echo($captions[$unthumb1]); ?></td>

<?php if($num_of_images>=$startimage+1){ ?>

<td width="33%" align="center"><?php echo($captions[$unthumb2]); ?></td>

<?php }?>

<?php if($num_of_images>=$startimage+2){ ?>

<td width="34%" align="center"><?php echo($captions[$unthumb3]); ?></td>

<?php }?>




if ($startimage > 0){$previmage=$startimage-3;

echo ("<a rel=\"nofollow\" href=\"$previmage\">previous</a>&nbsp;");







if($start==$startimage){echo("$pagenum \n");}else{

echo ("<a rel=\"nofollow\" href=\"$start\">$pagenum</a>\n");





if($num_of_images > $startimage+2){


echo ("<a href=\"$nextimage\">next</a>\n");