$width_scale) { $ratio = $width/$width_scale; $width = $width_scale; $height = round($height/$ratio); } $images = array_keys($imagearray); foreach ($images as $image) { if (!isset($last)) { $first = $image; } if ($now) { $next = $image; $now = false; } if ($image == $imagename) { $prev = $last; $now = true; } $last = $image; } if (!isset($prev)){ $prev = $last; } if (!isset($next)){ $next = $first; } print "
<-- previous back next -->

\"".$img_data['file']."\"
".$img_data['date']."
".$img_data['subject']."

\n"; print $img_data['description']; print "


\n\n"; // $notify = show_comments($img_data['file'], $table); // comment_form($img_data['file'], $table, $notify); } function show_all($imagearray, $page) { global $HTTP_SERVER_VARS, $home, $serverroot, $table, $picsperpage; // given page number and number of pics per page, find starting and // ending indexes $start = 0; if ($page == 0) { $end = $start+$picsperpage; } else { $start = $page*$picsperpage; if ($start > count($imagearray)) { $start = 0; $end = $start+$picsperpage; } else { $end = $start+$picsperpage; } } // find out how many pages there are $numpages = ceil(count($imagearray)/$picsperpage); print "

These pictures were taken with my mobile phone.

\n\n"; print "

photo tekniklog

".count($imagearray)." images; $picsperpage images/page; page "; print $page+1; print "/".$numpages."

\n\n"; print "
"; if ($page>0) { $last = $page-1; print "<<"; } print "
\n
"; if ($page<$numpages-1) { $next = $page+1; print ">>"; } print "
\n
"; print "

\n\n"; $curr = 0; foreach ($imagearray as $image) { if (($curr>=$start)&&($curr<$end)) { $thumbname = "/Pictures/camblog/tiny".$image['file']; // $comments = num_comments($image['file'], $table); //if ($comments==0) { //$nocomments = "No comments"; //} //else if ($comments==1) { //$nocomments = "One comment"; //} //else { //$nocomments = "$comments comments"; //} print "
\"".$image['date']."\"
\n"; if ($comments>0) { print "$nocomments
"; } else { print "$nocomments
"; } print $image['date']."
"; print $image['subject']; print "
\n"; } $curr++; } print "
\n\n"; print "
\n"; if ($numpages>1) { print "
"; print "~ Page ~
\n"; for ($i = 0; $i < $numpages; $i++) { if ($page==$i) { print " $i "; } else { print " $i "; } } print "
\n\n"; } } function sanitize($input) { $output = str_replace("
", "[br]", $input); $output = htmlspecialchars($output, ENT_QUOTES); $output = str_replace("[br]", "
\n", $input); return $output; } $workincludefile = $serverroot.$home."/camblog/index.txt"; $worklinearray = file($workincludefile); $worklines = array_keys($worklinearray); foreach ($worklines as $line) { $element = explode("::", $worklinearray[$line]); $thisfile = $element[0]; $thissubject = sanitize($element[1]); $thisdesc = sanitize($element[2]); $thisdate = date("M j Y H:i", substr($thisfile, 0, -4)); $images[$thisfile] = array("file"=>$thisfile, "subject"=>$thissubject, "description"=>$thisdesc, "date"=>$thisdate); } $images = array_reverse($images, TRUE); $image = $HTTP_GET_VARS['image']; $page = $HTTP_GET_VARS['page']; if (empty($page)) { $page = 0; } if (array_key_exists($image, $images)) { show_image($image, $images); } else { show_all($images, $page); } include('../footer.php'); ?>